AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
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 1056 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:
Speech Technology Magazine
Speech Technology is recognized worldwide as the leading source of information on speech technology solutions that are changing communications and technology needs of organizations worldwide.
SearchSAP
The Web's best SAP-specific information resource for enterprise IT professionals.
100% Free Subscription until Stock lost.View complete list.
Sponsored by