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 Master Page controls from the Child or Content Pages?
Posted by Moderator1 on  7/1/2009 7:11:53 AM 9522 Views
To find the controls in the Master Pages, you can use the FindControl method of the Master class.

The sample code is given below

HyperLink HyperLink1 = (HyperLink)Master.FindControl("HyperLink1");
if (HyperLink1 != null)
{
HyperLink1.NavigateUrl = "http://www.google.com/";
HyperLink1.Text = "Changing Text From Child Page";
}

The above code, finds the HyperLink control in the MasterPage with the FindControl method, if the HyperLink control exists, the we can changes the NavigateUrl and the Text property from the Child or content pages.

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
Backup and Recovery Best Practices for Microsoft SQL Server 2005
To help you choose from among the available configuration options and backup and recovery procedures, HP has conducted extensive laboratory tests to determine best practices.
FierceDeveloper
Is a free weekly email newsletter for the wireless developer community.
100% Free Subscription until Stock lost.View complete list.
Sponsored by