Development ASP.Net Tutorial

File: Default.aspx
<%@ Page Language="C#" MasterPageFile="~/Default.master" %>

    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;
            }
        }
        
    }

    ID="Content1"
    ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">
    Select a Master Page:
    
        

  •         Dynamic Master 1
            

  •         

  •         Dynamic Master 2
            

  •