File: Default.aspx
<%@ Page Language="C#" MasterPageFile="~/Default.master" %>
<script runat="server">
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request["master"] != null)
{
switch (Request["master"])
{
case "Dynamic1":
this.MasterPageFile = "Default.master";
break;
case "Dynamic2":
this.MasterPageFile = "MasterDefault.master";
break;
}
}
}
</script>
<asp:Content
ID="Content1"
ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
Select a Master Page:
<ul class="selectMaster">
<li>
<a href="Default.aspx?master=Default">Dynamic Master 1</a>
</li>
<li>
<a href="Default.aspx?master=MasterDefault">Dynamic Master 2</a>
</li>
</ul>
</asp:Content>
|