I am using visual studio 2013 for custom webparts and I have a page(call it X.aspx) which has a link that opens a modal popup(body only page) and has a custom webpart in it and it is referencing site custom master page(for X.aspx one)

How can I avoid the custom master page and apply the seattle master page.

I am trying to avoid header, footer from custom master page.

Thanks, Michaeld

  • 1
    Can you add a bit more detail? How are you creating and referencing the modal? As much detail as you can add will help to find you an answer. Commented Jan 8, 2015 at 16:11
  • @Shelby, I edited the question again for clarity .
    – user38490
    Commented Jan 8, 2015 at 16:55

1 Answer 1


When you call the page you can use the IsDlg=1 query string. That may be enough for what you need, but it depends on how the custom page was implemented and if it's still make's use of the notdlg classes.

Here is a potential answer on Stack Exchange regarding dynmaicly setting asp.net masterpages: https://stackoverflow.com/questions/581950/can-i-change-a-nested-master-pages-master-dynamically

Just tested this and it works from the PreInit of the Page that is using the nested MasterPage.
protected void Page_PreInit(object sender, EventArgs e)
    this.Master.MasterPageFile = "/Site2.Master";

Another method that may be possible is creating your own pagelayout class, that is used in publishing pages. If you look at the pages they don't seem to reference a master page directly, but pagelayout assembly.

Back to the notdlg classes, you could modify the masterpage and add in the MS class to the sections you want to hide and then just utilize the query string method.

To clarify there are actually two different classes depending on version

s4-notdlg - SP 2010
ms-dialogHidden - SP 2013

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.