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 2697 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:
Easing the Migration to Microsoft SQL Server 2005
There are many business and technological reasons for making the move to SQL Server 2005 and SQL Server 2005 Enterprise Edition. In tandem with 64-bit computing platforms, SQL Server 2005 can boost performance by 30% in certain instances, deliver a better database management structure and bolster infrastructure security.
The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition - Free 207 Page Preview!
A compilation of the best solutions provided to common PHP questions.
100% Free Subscription until Stock lost.View complete list.
Sponsored by