programmatically how to select MasterPage
-
I have a content page and two Master pages . Based on some condition I want to call one Master to the content page . For example C1 is a content page , M1 and M2 are two master pages based on some condition in C1(atloading of C1) page I want M1 or M2 to be called in C1 programmatically. anyone please Help me out :rose: Thanks in Advance :rose:
Kovuru Sreedhar
-
I have a content page and two Master pages . Based on some condition I want to call one Master to the content page . For example C1 is a content page , M1 and M2 are two master pages based on some condition in C1(atloading of C1) page I want M1 or M2 to be called in C1 programmatically. anyone please Help me out :rose: Thanks in Advance :rose:
Kovuru Sreedhar
You can set the masterpage of any page at runtime in pre_init event like protected void Page_PreInit(object sender, EventArgs e) { if (Request.Params[A1] != null) { this.MasterPageFile = "~/MasterPages/A1.master"; } else if (Request.Params[A2] != null) { this.MasterPageFile = "~/MasterPages/A2.master"; } else if (Request.Params[A#] != null) { this.MasterPageFile = "~/MasterPages/A3.master"; } }
Cheers!! Brij