Page Member

R

rn5a

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?
 
V

Velislav

nope :)

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

rn5a

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.
 
M

Mark Rae

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.
 
V

Velislav

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]
 
G

Guest

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top