Question

Working on a ASP.NET webform project. I have a MasterPage which works fine for 99% of my pages. However, on one page where I use a GridView, I need a slighty altered version of this MasterPage. I basically need to remove a few lines off of it:

    <%--<div id="pageContentInner">--%>
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
    <%--</div>--%>

Do I need to create a completely separate MasterPage or is there a way to disable that part only for that one page ?

Was it helpful?

Solution

Creating another MasterPage is probably the right way to go. Although you could do something like this:

Change your MasterPage div that needs to be invisible to a Panel.

Add a Property in the MasterPage to toggle visibility of that Panel:

public bool PageContentInnerViewable
{
    get
    {
        return PageContentInner.Visible;
    }
    set
    {
        PageContentInner.Visible = value;
    }
}

Change the visibility in page code-behind

this.Master.PageContentViewable = false;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top