Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing textbox in contentplaceholder
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MySQL
Divers
Thread ID:
01425958
Message ID:
01425982
Vues:
24
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform