Wednesday, 4 January 2012

Change your master page file property

if you want to change a maser page content according to your content page then you just write code in the preinit event within the content page codeview


protected void Page_PreInit(object sender, EventArgs e)
{

if (some condition)
{

this.MasterPageFile = "~/MasterSetup/AdminErst.master";
//Image img1 = (Image)Master.FindControl("logo");
//img1.ImageUrl = "~/image/ErstwhileLogo.png";
// Label lbl = (Label)Master.FindControl("AdminPNPLBL");
//lbl.Text = "Erstwhile Infrastructure PrivateLimited";
//img1.Width =178;

}
else
{
this.MasterPageFile = "give your anotherFilename";
}
}

No comments:

Post a Comment