“s4-notdlg” not doing what it should be doing

Today, I was playing around in SharePoint 2010 and I was setting up a FAQ where you show the questions using a CQWP and open the details in a SharePoint popup dialog. Works great but the problem was that I was trying out a custom masterpage and the dialog showed the complete masterpage with the header, left navigation and so on… not what you want. I switched to a OOTB masterpage and it worked. So it had to be something in my custom masterpage.

Then it hit me, you need to add the s4-notdlg class to the elements you don’t want to render in a popup. Offcourse! Stupid!

I added the class but damn… still no joy. I found a post from Ben Ramey where he explained the same behavior if you forgot the <SharePoint:CssLink runat=”server” Version=”4″ />. But this tag was included in my masterpage. So, this was not the reason.

I started comparing an OOTB masterpage with mine and starting changing small things here and there, testing along the way.
And I found the culprit… it was the runat=”server” attribute on the <html> tag which wasn’t in mine. After I added it, the tags which had the s4-notdlg class didn’t render in a dialog anymore.

Another thing I noticed was that some items didn’t show up directly in the CQWP. Even if I checked them in. Did some searching and I stumbled on an article of Michael Nemtsev where he explains this and gives a workaround. (Why Content Query Web Part (CQWP) doesn’t return all results)

One thought on ““s4-notdlg” not doing what it should be doing”

Leave a Reply