[CLOSED] [1.0] Load dynamic UserControl with Coolite Controls.

  1. #1

    [CLOSED] [1.0] Load dynamic UserControl with Coolite Controls.

    Hi again,

    I'm trying to load a user control with coolite components on a button click event, and it does perfectly.

    Well, inside this user control there are a button and a textfield, and here is the problem, when I click in ButtonTest_Click appears this sweet error :confused:

    The control with ID 'ctl07_ButtonNew' not found

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The control with ID 'ctl07_ButtonNew' not found

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:

    [HttpException (0x80004005): The control with ID 'ctl07_ButtonNew' not found]
    Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1123
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +176
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


    Here is the example:

    WebForm1.aspx
    -------------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:Button ID="ButtonNewWindow" runat="server" Text="New Window">
                <DirectEvents>
                    <click onevent="ButtonNewWindow_Click">
                <EventMask ShowMask="true" MinDelay="1000" />
            </click>
                </DirectEvents>
            </ext:Button>
        </div>
        </form>
    </body>
    </html>
    WebForm1.aspx.vb
    -----------------------
    Imports Ext.Net
    
    Public Class WebForm1
        Inherits Global.System.Web.UI.Page
    
        Protected Sub ButtonNewWindow_Click(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
    
            Dim newW As New Ext.Net.Window
            newW.ID = "WIN"
            newW.Width = 200
            newW.Height = 200
            newW.Title = "Test"
    
            Dim uControl As UserControl = LoadControl("WebUserControl1.ascx")
    
            newW.ContentControls.Add(uControl)
    
            Me.Controls.Add(newW)
    
            newW.Render()
    
        End Sub
    
    End Class
    WebUserControl1.ascx
    -------------------------
    <ext:Button ID="ButtonNew" runat="server" Text="Submit">
        <DirectEvents>
            <click onevent="ButtonTest_Click" StopPropagation="true">
                <EventMask ShowMask="true" MinDelay="1000" />
            </click>
        </DirectEvents>
    </ext:Button>
    <ext:TextField ID="TextField1" runat="server">
    </ext:TextField>
    WebUserControl1.ascx.vb
    ------------------------------
    Public Class WebUserControl1
        Inherits Global.System.Web.UI.UserControl
    
        Protected Sub ButtonTest_Click(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
            Me.TextField1.Text = "TEST"
        End Sub
    
    End Class
    Could you help me?

    FVNoel
    Last edited by Daniil; Oct 22, 2010 at 5:27 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You have to recreate dynamic window on each request (it is ASP.NET requirement) otherwise ASP.NET cannot find the control (ASP.NET is stateless system therefore all controls must be recreated, markup controls are recreated automatically but dynamic controls must be recreated manually)
  3. #3
    Hi vladimir,

    Ok thanks, I was thinking that it did it automatically.

    Greetings,

    FVNoel
  4. #4
    Hi,

    Probably the last post from this thread will be interest for you.
    http://forums.ext.net/showthread.php....AddTo%29-quot
  5. #5
    Hi Dan,

    Probably the last post from this thread will be interest for you.
    http://forums.ext.net/showthread.php....AddTo%29-quot
    Thanks for yor suggestion, I didn't know that it is possible, but this Window it's not only for submit values.

    I wrote this post because we want to generate a dinamic Window from a GridView, then in that Window we will(or not) load another controls dynamically, for example, a form with a grid, that loads a window when I edit a row, and that window load some fields and another grid that does like the previous one ...(all dynamically).

    Sorry about my english. :rolleyes:
  6. #6
    Hi,

    That's right, in your case controls must be recreated during each request.

Similar Threads

  1. How to load dynamic user controls on desktop shortcut?
    By laphuynhkien in forum 2.x Help
    Replies: 4
    Last Post: Aug 23, 2012, 5:58 PM
  2. Replies: 5
    Last Post: Nov 03, 2011, 2:39 AM
  3. dynamic load usercontrol in ext:pannel.
    By PrasadJoshi in forum 1.x Help
    Replies: 5
    Last Post: Jan 17, 2011, 9:54 AM
  4. [CLOSED] Dynamic load user controls in Opera
    By Timur.Akhmerov in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 06, 2010, 2:49 AM
  5. [CLOSED] Load Coolite controls from AjaxEvent or AjaxMethod
    By pumpkin in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 02, 2009, 11:02 PM

Posting Permissions