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 1771 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:
The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks - Free 158 Page Preview
Get the most out of this complete question-and-answer book on JavaScript.
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
100% Free Subscription until Stock lost.View complete list.
Sponsored by