Wednesday, September 21

Changing Master Page at Runtime


protected void Page_PreInit(object sender, EventArgs e) 
{ 
 if (Membership.GetUser() == null) //check the user weather user is logged in or not

    this.Page.MasterPageFile = "~/General.master";
 else
    this.Page.MasterPageFile = "~/myMaster.master";
}
we can change the content of master page from inherited page too like below

<CODE>Master.FindControl("nameLbl").Visible = true;

No comments:

Post a Comment

Please don't spam, spam comments is not allowed here.

ShibashishMnty
shibashish mohanty