View Single Post
 
Old June 16th, 2006, 10:34 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You could add a public property to your control, that gives access to your server control, like this:

public TextBox UserNameBox
{
  get
  {
    return txtUserName;
  }
}

This way, the page can access the control, but not completely change it. You can, however, change its own properties like its Text property. If you want to be able to change the entire box, implement a set accessor as well.

Now you can access the properties like this:

MyUserControl.UserNameBox.Text = "SomeText";

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004