Expose the Web Part Title in the XSL of your CQWP

The last couple of days, I have been busy with customizing the OOTB Content by Query Web Part and Summary Links Web Part from SharePoint 2010. I wanted to get rid of the default look and chrome and present my data in a nice box with rounded corners and a title with matches the rest of my styles.
After 2 days of trying, I can say… the result is too my liking. 🙂

The first box is a Summary Links Web Part and the box below it, is a Content by Query Web Part.
To get rid of the default chrome, I simply set it to None in the Web Part properties.

Read more

“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)