Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
What are the different ways to set MasterPage of a page in ASP.NET

Posted On: 02/10/2013 12:00:40
  1. <%@ Page Language="C#" MasterPageFile="~/Master1.master"

  2. void Page_PreInit(object sender, EventArgs e)
        {
            MasterPageFile = "~/SiteMaster.master";
        }
     
  3. Create a Http Module and inside that module
        set the master page as below:
        void page_PreInit(object sender, EventArgs e)
        {
            Page page = sender as Page;
            if (page != null)
            {
                page.MasterPageFile = "~/SiteMaster.master";
            }
        }
MOST VIEWED QUESTION:
 
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us