Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reference a control in user control?
Message
From
04/02/2010 10:45:54
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01447396
Message ID:
01447496
Views:
40
Hi,

I assume you are referring to using the control in a form ? If so you will need to expose the TextBox as a public property of the UserControl:
 public TextBox MyTextBox
        {
            get { return txtMyEntry; }
            set { txtMyEntry = value; }
        }
Then, in the form you can reference it as MyUserControlName.MyTextBox.Text etc. But you might consider only exposing those properties of the TextBox that you want to be accessible in this way - the above may be too flexible
HTH
Viv (temporarily in disguise since my logon's not working :-}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform