Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing textbox in contentplaceholder
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MySQL
Miscellaneous
Thread ID:
01425958
Message ID:
01425982
Views:
25
>Hi..
>how about if the control isnot in master?

What kind of scenario is this? ContentPlaceHolder is really just meant for master pages. However, if you are using it some other way you can use the FindControl method of it to get a reference to the control inside of it. Just realize that FindControl will only find the textbox if it's a child of the ContentPlaceHolder and not nested deeper inside of some other control.
// Replace ContentPlaceHolder1 with the actual name of it
TextBox text = this.ContentPlaceHolder1.FindControl("txtMyTextBox") as TextBox;

if (text != null)
{
   //
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform