The control with ID not found

  1. #1

    The control with ID not found

    I created a window by code behind, but when I try to capture the event to close I get an error saying it is not possible to find the control id.

    protected void LoadWindowFromCodeBehindWithParams(object sender, DirectEventArgs e)
    {
    	int myid = 0;
    
    	Ext.Net.Window win = new Ext.Net.Window();
    	win.ID = "wmId";
    	win.Width = Unit.Pixel(1185);
    	win.Height = Unit.Pixel(660);
    	win.Scrollable = ScrollableOption.Disabled;
    	win.Modal = true;
    	win.Loader = new ComponentLoader();
            win.Loader.Url = "~/App/mypage.aspx?id=" + myid;
    	win.Loader.Mode = Ext.Net.LoadMode.Frame;
    	win.Loader.LoadMask.ShowMask = true;
    
    	win.DirectEvents.Close.Event += MyMethod;
    
       	win.Render(this);			
    }
    public void MyMethod(object sender, DirectEventArgs e)
    {
    string value = "ok";
    }

    Click image for larger version. 

Name:	control_id_not_found.jpg 
Views:	185 
Size:	89.6 KB 
ID:	25399
  2. #2
    Unfortunately, this scenario just doesn't work in ASP.NET Web Forms.

    The two requests are stateless and in the second request, the Event handler is not aware of the Window control created in a previous request.

    You could try something like this...

    public void MyMethod(object sender, DirectEventArgs e){
        Ext.Net.Window win = new Ext.Net.Window();
        win.ID = "wmId";
        
        string value = "ok";
    }
    Another option would be calling a DirectMethod instead of DirectEvent.
    Geoffrey McGill
    Founder
  3. #3
    Hello. Thanks for replay.


    With this code the same error happens.

    public void MyMethod(object sender, DirectEventArgs e){
        Ext.Net.Window win = new Ext.Net.Window();
        win.ID = "wmId";
        
        string value = "ok";
    }
    Another option would be calling a DirectMethod instead of DirectEvent.
    Could you give a code example of how I would do this?

    Thanks.

Similar Threads

  1. Replies: 1
    Last Post: Aug 18, 2017, 9:03 PM
  2. Replies: 8
    Last Post: Nov 28, 2013, 6:39 AM
  3. The Control Not Found!
    By flaviodamaia in forum 2.x Help
    Replies: 1
    Last Post: Feb 20, 2013, 1:51 PM
  4. The control with ID 'ctl04_AddDoc' not found
    By geraldf in forum 2.x Help
    Replies: 1
    Last Post: Aug 24, 2012, 2:45 PM
  5. Replies: 2
    Last Post: Nov 02, 2011, 7:07 AM

Posting Permissions