Condividi tramite


Using Reporting Service web part with SharePoint custom master pages

Recently I and my team were working on an interesting issue where when you use a custom master page built out of a HTML script with the help of SharePoint 2013, the reports that are referred with in a web part page doesn’t render.

Here is the article that could help you with building custom HTML MasterPage for SharePoint 2013.

Once you’ve the masterpage ready and published, all you’ve to do is to ensure you select the SharePoint site or web application to use the newly published master page.

This can be done by going to Site settings –> Under Look and Feel select Design Manager –> Publish and Apply Design –> Apply master pages to your site based on device channel and Select the newly published master page for Default and All Channels.

Once it is done, try opening the web part page that contains the Reporting services web part and try rendering a report. You’ll not get any render response even after you click the Apply button.

The same web part page renders the report successfully when I use the master pages that come with SharePoint.

To identify what makes the difference, I downloaded the custom master page and opened the same in a notepad. Since I know that we require the scriptmanager and the web part manager (Learnt by experience Smile), I searched for those two components in the custom master page.

I found ScriptManager within the Body tag.

<body onhashchange="if (typeof(_spBodyOnHashChange) != 'undefined') _spBodyOnHashChange();"><SharePoint:SPClientIDGenerator runat="server" ServerControlID="DeltaPlaceHolderMain;DeltaPlaceHolderPageTitleInTitleArea;DeltaPlaceHolderUtilityContent" /><SharePoint:ImageLink runat="server" /><SharePoint:SharePointForm onsubmit="if (typeof(_spFormOnSubmitWrapper) != 'undefined') {return _spFormOnSubmitWrapper();} else {return true;}" runat="server"><asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />

But the WebPart manager was within the head tag like below.

<SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">
            <WebPartPages:SPWebPartManager runat="server">
</WebPartPages:SPWebPartManager>
        </SharePoint:AjaxDelta>

I moved the WebPartPages section out of the Head tag / SharePoint tag within the body tag, just below the ScriptManager element, as shown below.

<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />

<WebPartPages:SPWebPartManager runat="server">
</WebPartPages:SPWebPartManager>

Remove the below section from the head tag of the custom master page.

<SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">
<WebPartPages:SPWebPartManager runat="server">
</WebPartPages:SPWebPartManager>
</SharePoint:AjaxDelta>

Save the file, upload it back to SharePoint and republish it as MasterPage.

Select the new master page as theme for the site and now open the web part page.

Yes, the report does RENDER as expected.

Enjoy Reporting!

Selva.

[All the posts are AS-IS without any warranty]

Comments

  • Anonymous
    January 03, 2014
    The comment has been removed

  • Anonymous
    March 17, 2014
    The comment has been removed

  • Anonymous
    July 02, 2014
    Nice Article...Worked Perfect.

  • Anonymous
    November 05, 2016
    Thanks ! this Helps!!!

  • Anonymous
    December 26, 2016
    Great Article , saved me from a Bizarre