Click here to Skip to main content
15,885,914 members
Articles / Web Development / ASP.NET

Inside Master Pages

Rate me:
Please Sign up or sign in to vote.
4.81/5 (57 votes)
18 Aug 200511 min read 334.2K   2.7K   153  
Every thing you need on master pages. This article takes your from the first step to the depth.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class nestedMasters : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		childMaster myChildMaster =(childMaster)this.Master;
		//interaction using properties
		myChildMaster.changeLocalControl("label1", "this is changed from content page");
		myChildMaster.changeMasterControl("pageTitle", "this is changed from content page");
		
		//interaction using FindControl
		Label lbl = myChildMaster.Master.FindControl("label1") as Label;
		lbl.Text = "testing";
		Button btn = myChildMaster.Master.FindControl("ContentPlaceHolder1").FindControl("button1") as Button;
		btn.Text = "by the content page";
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Ireland Ireland
Expert in Microsoft technologies.
MCP+Site Building, MCSD, MCAD, and MCSD.NET (Early achiever)
Worked as Web developer, Trainer and software developer
Currently working as Developer support engineer.
You can contact me also through my blog http://blogs.msdn.com/mohamed_sharafs_blog/

Comments and Discussions