Referencing a control outside of a user control

G

Guest

Hello,
I'd like to reference a control in a user control that is not in the user
control. For esample, if I had the following in my .aspx:

....
<html>
<form ID="frmMain"....>
...
<asp:Label ID="lblMessage" ...>...</asp:Label>
<uc:MyUserControl ID="ucTest"...></uc:MyUserControl>
...
</form>
</html>
....

In any code behind routine of my user control ucTest I'd like to set:
lblMessage.Text = "Hello"

But the user control doesn't 'see' the label. I can write an algorithm/code
to cycle through all page controls to get the reference of the control I
want, but is there an easier way?
Much oblige - Hedge :)
 
C

CT

Have you tried accessing the User Controls Parent control and that way gain
access to the label?
 

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

Top