|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
If I place a usercontrol .ascx on a webform .aspx, is there a way to access
the clientid propery of controls on the webform .aspx from within the Page_Load of the .ascx. For example, I have a webform with ... <asp:textbox id="txtOne" runat="server"> and a usercontrol ... <test:usercontrol id="testUserControl" runat="server"> Now, how can i access the clientid of txtOne from within the Page_Load event of the UserControl? Hi,
generally it is not good idea to access Page from the control because it would make the control specific to that page. Therefore more suitable would be declaring property in the UC (representing the ClientID), which Page could set in code. Show quoteHide quote "Ben Schumacher" <bschumac***@navegate.com> wrote in message news:OiMU0JlWGHA.924@TK2MSFTNGP03.phx.gbl... > If I place a usercontrol .ascx on a webform .aspx, is there a way to > access the clientid propery of controls on the webform .aspx from within > the Page_Load of the .ascx. > > For example, I have a webform with ... > > <asp:textbox id="txtOne" runat="server"> > > and a usercontrol ... > > <test:usercontrol id="testUserControl" runat="server"> > > Now, how can i access the clientid of txtOne from within the Page_Load > event of the UserControl? >
Other interesting topics
UserControls and Collections Property
I do I remove the style attribute from Image controls? Link to download a file. .NET 2.0 TreeView control vertical align problem Dynamically move control. Problem in designing layout of website dynamic controls Passing data into a custom control Please help ..... GridView project or website location in design time |
|||||||||||||||||||||||