Print Shortlink

SharePoint sub site roll up with SharePoint Designer

It’s pretty common that you need a roll up of sub-sites on your site. In this example we’ll take a look at how to get this roll up using SharePoint designer with no code since many environment won’t allow .net code in your SharePoint pages.
Check out the video and here is where you can grab a snippet we used in the video.

Enjoy!

To be placed in page head, see video for example

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    var hideSitesTaggedAs = "Closed";

    $(".description-style:contains('"+hideSitesTaggedAs+"')").parent().hide();
    $(".description-style").css('display', 'none');
});
</script>

To be placed in page body, see video for example

<SharePoint:SPDataSource
ID="SPDataSource1"
runat="server"
DataSourceMode="Webs"
IncludeHidden="true">
<SelectParameters>
<asp:Parameter Name="WebId" DefaultValue="RootWeb" />
</SelectParameters>
</SharePoint:SPDataSource>

<SharePoint:SPGridView
ID="GridView1"
runat="server"
DataSourceID="SPDataSource1"
AutoGenerateColumns="false">
<Columns>
<asp:HyperLinkField DataTextField="__spTitle" DataNavigateUrlFields="__spUrl" />
<asp:BoundField DataField="__spDescription" ItemStyle-CssClass="description-style"/>
</Columns>
</SharePoint:SPGridView>