Changing Master Page on Runtime
Use following code:
protected void Page_PreInit(object sender, EventArgs e) { if (Session["user"] == null) this.Page.MasterPageFile = "~/MasterPage2.master"; else this.Page.MasterPageFile = "~/MasterPage1.master"; }
The key here is to put the code in Page_PreInit.
References:
No comments:
Post a Comment
Thank You for Your Comments. We will get back to you soon.