Page Member

Discussion in 'ASP .Net' started by rn5a@rediffmail.com, Nov 24, 2006.

  1. Guest

    I have a user control page named MyUC.ascx which has a Panel control
    This Panel, in turn, has a TextBox. Next I use this user control in an
    ASPX page named MyPage.aspx by registering the user control using the
    following Register directive in the ASPX page

    <%@ Register TagPefix="UC" TagName="UControl" Src="MyUC.ascx" %>

    <form runat="server">
    <UC:UControl ID="uc1" runat="server"/>
    </form>

    Now if I am not mistaken, the hierarchy of the controls in the ASPX
    page would be

    Page
    Form
    User Control
    Panel
    TextBox

    As per the above hierarchy diagram, the TextBox is a member of the
    Panel's Controls Collection but isn't the TextBox also a member of the
    Page's Controls Collection here?
    , Nov 24, 2006
    #1
    1. Advertising

  2. Velislav Guest

    nope :)

    The Controls collection only contains the children controls, not the
    children of the children (and so on).

    wrote:
    > I have a user control page named MyUC.ascx which has a Panel control
    > This Panel, in turn, has a TextBox. Next I use this user control in an
    > ASPX page named MyPage.aspx by registering the user control using the
    > following Register directive in the ASPX page
    >
    > <%@ Register TagPefix="UC" TagName="UControl" Src="MyUC.ascx" %>
    >
    > <form runat="server">
    > <UC:UControl ID="uc1" runat="server"/>
    > </form>
    >
    > Now if I am not mistaken, the hierarchy of the controls in the ASPX
    > page would be
    >
    > Page
    > Form
    > User Control
    > Panel
    > TextBox
    >
    > As per the above hierarchy diagram, the TextBox is a member of the
    > Panel's Controls Collection but isn't the TextBox also a member of the
    > Page's Controls Collection here?
    Velislav, Nov 24, 2006
    #2
    1. Advertising

  3. Guest

    Velislav, that means that even the Panel control is not a member of the
    Page's Control Collection but the user control is a member of the
    Page's Controls Collection, isn't it? Please correct me if I am wrong.

    Thanks for the prompt response.


    Velislav wrote:
    > nope :)
    >
    > The Controls collection only contains the children controls, not the
    > children of the children (and so on).
    >
    > wrote:
    > > I have a user control page named MyUC.ascx which has a Panel control
    > > This Panel, in turn, has a TextBox. Next I use this user control in an
    > > ASPX page named MyPage.aspx by registering the user control using the
    > > following Register directive in the ASPX page
    > >
    > > <%@ Register TagPefix="UC" TagName="UControl" Src="MyUC.ascx" %>
    > >
    > > <form runat="server">
    > > <UC:UControl ID="uc1" runat="server"/>
    > > </form>
    > >
    > > Now if I am not mistaken, the hierarchy of the controls in the ASPX
    > > page would be
    > >
    > > Page
    > > Form
    > > User Control
    > > Panel
    > > TextBox
    > >
    > > As per the above hierarchy diagram, the TextBox is a member of the
    > > Panel's Controls Collection but isn't the TextBox also a member of the
    > > Page's Controls Collection here?
    , Nov 24, 2006
    #3
  4. Mark Rae Guest

    <> wrote in message
    news:...

    > As per the above hierarchy diagram, the TextBox is a member of the
    > Panel's Controls Collection but isn't the TextBox also a member of the
    > Page's Controls Collection here?


    No.
    Mark Rae, Nov 24, 2006
    #4
  5. Velislav Guest

    That is correct, the Panel is part of the User Control's Controls, but
    not the Page's Controls.

    To get to the Panel from the Page, you'd have to do something like

    Page.Controls[userControlIndex].Controls[panelControlIndex]


    wrote:
    > Velislav, that means that even the Panel control is not a member of the
    > Page's Control Collection but the user control is a member of the
    > Page's Controls Collection, isn't it? Please correct me if I am wrong.
    >
    > Thanks for the prompt response.
    >
    >
    > Velislav wrote:
    > > nope :)
    > >
    > > The Controls collection only contains the children controls, not the
    > > children of the children (and so on).
    > >
    > > wrote:
    > > > I have a user control page named MyUC.ascx which has a Panel control
    > > > This Panel, in turn, has a TextBox. Next I use this user control in an
    > > > ASPX page named MyPage.aspx by registering the user control using the
    > > > following Register directive in the ASPX page
    > > >
    > > > <%@ Register TagPefix="UC" TagName="UControl" Src="MyUC.ascx" %>
    > > >
    > > > <form runat="server">
    > > > <UC:UControl ID="uc1" runat="server"/>
    > > > </form>
    > > >
    > > > Now if I am not mistaken, the hierarchy of the controls in the ASPX
    > > > page would be
    > > >
    > > > Page
    > > > Form
    > > > User Control
    > > > Panel
    > > > TextBox
    > > >
    > > > As per the above hierarchy diagram, the TextBox is a member of the
    > > > Panel's Controls Collection but isn't the TextBox also a member of the
    > > > Page's Controls Collection here?
    Velislav, Nov 24, 2006
    #5
  6. The defining element here is the concept of Controls that are part of the
    Page's Control tree, but which controls have their own child control
    hierarchy.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "" wrote:

    > I have a user control page named MyUC.ascx which has a Panel control
    > This Panel, in turn, has a TextBox. Next I use this user control in an
    > ASPX page named MyPage.aspx by registering the user control using the
    > following Register directive in the ASPX page
    >
    > <%@ Register TagPefix="UC" TagName="UControl" Src="MyUC.ascx" %>
    >
    > <form runat="server">
    > <UC:UControl ID="uc1" runat="server"/>
    > </form>
    >
    > Now if I am not mistaken, the hierarchy of the controls in the ASPX
    > page would be
    >
    > Page
    > Form
    > User Control
    > Panel
    > TextBox
    >
    > As per the above hierarchy diagram, the TextBox is a member of the
    > Panel's Controls Collection but isn't the TextBox also a member of the
    > Page's Controls Collection here?
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Nov 25, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DJ Dev
    Replies:
    3
    Views:
    16,095
    Gandalf
    Feb 8, 2004
  2. Replies:
    1
    Views:
    297
    Martin Dechev
    Oct 7, 2004
  3. ding feng
    Replies:
    8
    Views:
    838
    Dhruv
    Jul 2, 2003
  4. Newsgroup - Ann
    Replies:
    5
    Views:
    589
    John Carson
    Jul 30, 2003
  5. slide_o_mix
    Replies:
    0
    Views:
    407
    slide_o_mix
    Oct 15, 2003
Loading...

Share This Page