.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Call MasterPage controls from its ContentPlaceHolder Page.

Posted By:Pravin       Posted Date: May 18, 2012    Points: 25    Category: Visual Studio    URL: http://www.dotnetspark.com  

Here we can see how to control master page controls to handle from its content pages.
 

//Place the Label control in MasterPage.master
<asp:Label runat="server" ID="lblHome"></asp:Label>

//Add a new aspx page by adding MasterPage.master with it

//Place the below code in codebehind of new aspx page,that to call MasterPage Label control

Label lbl = (Label)Master.FindControl("lblHome");
lbl.Text = "Something";
lbl.BackColor = System.Drawing.Color.Blue;
lbl.ForeColor = System.Drawing.Color.White;
lbl.Font.Bold = true;



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend