The following example shows how you can get a reference to controls on the master page.
// gets a reference to a textbox control inside a contentplaceholder
ContentPlaceHolder mpContentPlaceHolder;
TextBox mpTextBox;
mpContentPlaceHolder = ( ContentPlaceHolder ) Master.FindControl("ContentPlaceHolder1");
if ( mpContentPlaceHolder != null )
{
mpTextBox = ( TextBox ) mpContentPlaceHolder.FindControl ( "TextBox1" );
if ( mpTextBox != null )
{ mpTextBox.Text = "TextBox found!"; }
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment