Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 How to Find Child or Content Page Controls From Master Page?
Posted by Moderator1 on  7/1/2009 7:17:07 AM 7300 Views
This tip helps you to find the content page controls from the Master Pages. The FindControl method helps to find the child page controls, so in step 1, you need to find the content placeholders of the Master page, then in the content placeholder, you have to find the control using the FindControl method.

The sample code is as follows

ContentPlaceHolder ContentPlaceHolder1 = (ContentPlaceHolder)this.FindControl("ContentPlaceHolder1");
if (ContentPlaceHolder1 != null)
Label lbChildLabel = (Label)ContentPlaceHolder1.FindControl("lbChildLabel");
if (lbChildLabel != null)
lbChildLabel.Text = "Changing Text From Master Page";

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
Sexy Web Design - Free 71 Page Preview!
An easy-to-follow guide that reveals the secrets of how to build your own breathtaking web interfaces from scratch.
When Good HTML Goes Bad: How You Can Protect Your Web Applications
This webinar highlights how modern attacks target the web browser – and the best practices to safeguard your web applications against these risks.
100% Free Subscription until Stock lost.View complete list.
Sponsored by