UserControl

B

Ben Schumacher

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

Teemu Keiski

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.
 

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,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top