Hide master page elements in dialogs in SharePoint 2013

Hide master page elements in dialogs in SharePoint 2013
InfoPath alternatives for form designing SharePoint

In this post we will discuss how to hide master page elements in dialog boxes in SharePoint 2013. Recently we were working in a migration web site from MOSS 2007 to SharePoint 2010 and then to SharePoint 2013 by using the database upgrade approach. There we were using a master page and in that master page there was a navagation menu presented there. Those navigation menu was coming in our Add item in list dialog boxes.

You may like to read:
– Create a responsive mobile master page using SharePoint 2013 designer

– Creating fixed width master page in SharePoint 2013

– Change Master Page using PowerShell in SharePoint 2013

When I search I found a very good post from Eric and followed that and it works like champ. Thanks Eric for sharing this.

In SharePoint 2013 there is a class know as “ms-dialogHidden”. If you will add this class to the HTML block, that Html block will not appear in the dialog boxes.

Example:
<div id=”global-menu” class=”ms-dialogHidden”>
Here was our global menu.
</div>

After this the above section will not appear in the dialog boxes in SharePoint 2013. We can check this in Master pages, Page layouts or any other pages referenced from the master pages.

The same thing works in SharePoint 2010, but with a different class name. The class name is: “s4-notdlg”

Example:
<div id=”global-menu” class=”s4-notdlg”>
Here was our global menu.
</div>

Here is an example where in Add new item dialog box one of our global navigation is coming like below:

Hide master page elements in dialogs in SharePoint 2013
Hide master page elements in dialogs in SharePoint 2013

And after using ms-dialogHidden class, the global navigation did not appear like below:

Hide master page elements in dialogs in SharePoint 2013
Hide master page elements in dialogs in SharePoint 2013

Hope this will be helpful.

Similar SharePoint 2013 Tutorials

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply