How to apply different master page template in condition to a webpage with ASP.Net

2008-10-12

I have a record update webpage in my CMS system implementing separate master page template in condition.
It includes the header, navigation menu and footer if display in main browser window, else it will hide them.

To achive this you need to set the 'MasterPageFile' property in the Page_PreInit event. Below is the code example:
 

protected void Page_PreInit(object sender, EventArgs e)
{
    mode = Request.QueryString["mode"]; // Put your own code here to capture the condition
    if (mode == "NoMenu")
        Page.MasterPageFile = "~/PopupPage.master";
    else
        Page.MasterPageFile = "~/MasterPage.master";
}

Previous Article:
Transfer data from Excel to MS SQL in ASP.Net





Categories

Search eGaWa.Blog

Keyword 1
Keyword 2
Keyword 3
Category
Search

Search Web

Reload Page