[CLOSED] Urgent: Ext.Net.Utilities.ControlUtils.FindControls does not return controls inside <Content> section in DirectMethod

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Urgent: Ext.Net.Utilities.ControlUtils.FindControls does not return controls inside <Content> section in DirectMethod

    I had a Aspx page which was rendered in an iframe using GET requests (consisting purely of Ext.Net controls).

    Using
    Ext.Net.Utilities.ControlUtils.FindControls<Ext.Net.Observable>
    on any component returned all its descendants (in both <Items> and <Content> sections of Containers).

    I have now refactored the code and moved it inside a UserControl (.ascx), which is rendered to an existing page in DirectMethod (using panel.Render()). Now when I call:

    Ext.Net.Utilities.ControlUtils.FindControls<Ext.Net.Observable>
    on a Container, it returns Components under <Items> section, but not under <Content> section of child containers. This is really important, and can you please have a look??
    Last edited by Daniil; Mar 24, 2011 at 6:23 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Do you recreate dynamically rendered controls during each request?

    If no, .FindControls() can't find these controls because they are not exists.
  3. #3
    I am not sure what is meant here, but to give you some idea, I have a single page now, let's say: Page1.aspx

    and 3 UserControls, UserControl1.ascx etc..

    When you click Button1 on Page1, a DirectMethod request goes out which instantizes UserControl1, adds it to a Panel and renders it to the page. And similar things happen for other UserControls.

    Now there are NO dynamic controls (i.e. no controls created in code-behind) and all controls are in markup.

    I will re-check if the Panel to which UserControl has been added is itself added to page or not. Do you think this would make a difference??
  4. #4
    Hi,

    I am not sure How do the following two sentences are consistent with each other?
    When you click Button1 on Page1, a DirectMethod request goes out which instantizes UserControl1, adds it to a Panel and renders it to the page. And similar things happen for other UserControls.
    Now there are NO dynamic controls (i.e. no controls created in code-behind) and all controls are in markup.
    As I undertstood first sentence, you create dynamic control
    Can provide test sample?
  5. #5
    Hi vlad, please find a sample attached.

    I meant that UserControl1 is instantized dynamically, but Ext.Net controls are only in markup. The attached sample should help you understand.
    Attached Files
  6. #6
    Okay, I think I found a solution after trying things out... Adding the UserControl/Parent Panel (pnl1) to the page's control collections before using FindControls resolved the issue, i.e. this code worked:

                this.Controls.Add(ctl.pnl);
    
                var l=Ext.Net.Utilities.ControlUtils.FindControls<Ext.Net.Observable>(ctl.pnl, false);
  7. #7
    Quote Originally Posted by r_honey View Post
    Adding the UserControl/Parent Panel (pnl1) to the page's control collections before using FindControls resolved the issue, i.e. this code worked:

                this.Controls.Add(ctl.pnl);
    
                var l=Ext.Net.Utilities.ControlUtils.FindControls<Ext.Net.Observable>(ctl.pnl, false);
    It should be rather this:

                this.Controls.Add(ctl);
    
                var l=Ext.Net.Utilities.ControlUtils.FindControls<Ext.Net.Observable>(ctl.pnl, false);
    You should add the UserControl (ctl) and not an Ext.Net.Panel to Page because UserControl implements INamingContainer and hence ensures generation of unique ClientIDs for child controls.
  8. #8
    Hi,

    Controls from Content area are placed inside ContentContainer control.
    ContentContainer control is added to Controls collection inside CreateChildControls method, that method is executed by ASP.NET when a control is added to the page (or parent component is added to the page)

    Therefore you cannot find Content controls until you added the control to the page
  9. #9
    Quote Originally Posted by Vladimir View Post
    Controls from Content area are placed inside ContentContainer control.
    ContentContainer control is added to Controls collection inside CreateChildControls method, that method is executed by ASP.NET when a control is added to the page (or parent component is added to the page)

    Therefore you cannot find Content controls until you added the control to the page
    Okay I understand that. But in this scenario, how come the same controls get rendered to the client?? Earlier I was not adding the control to the page which meant CreateChildControls never got executed which further meant they did not get added to the Controls collection.

    But they still render to the client, just that I am not able to access them on server via a call to FindControls.
  10. #10
    Hi,

    As I mentioned, we create temp page if dynamic control is not added to a page.
    ASP.NET calls CreateChildControls method for the control when we place the control to the temp page
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] User Controls & Performance problems - Urgent
    By andreasperanza in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Jun 11, 2012, 2:24 PM
  2. Replies: 0
    Last Post: Jan 11, 2012, 8:30 AM
  3. controls inside panel urgent help
    By bilgecooliteforum in forum 1.x Help
    Replies: 1
    Last Post: Apr 29, 2010, 12:28 PM
  4. Urgent please Binding asp.net controls
    By miguelp120 in forum 1.x Help
    Replies: 2
    Last Post: Apr 21, 2010, 4:20 PM
  5. Replies: 3
    Last Post: Sep 19, 2008, 6:12 PM

Tags for this Thread

Posting Permissions