a developer's notes – a semi-technical web development BLOG

September 5, 2011

Finding a control in a ASP.Net webpage that uses a Master and Content page

Filed under: ASP.NET — Duy Nguyen @ 1:48 pm
Tags: , , , , , , ,

Finding a control without a Master page can be done with this:


But if you use a Master page with a content page, it won’t work. Try this…

ContentPlaceHolder cph = this.Form.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;

TextBox ctrlInput = (TextBox)cph.FindControl("mycontrol");

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: