Online Training On SharePoint

Tuesday, 18 May 2010

Addding Option To Group List Items by Content Type in SharePoint 2010

In SharePoint 2007 there is option to group the List Items using the Content Type. This option is not present with SharePoint 2010 so we can not group list items based on the . I think by mistake Microsoft forgot to add that :(

This can be achieved very easily using SharePoint Designer 2010. Here are the steps to do this:
1. Create a view with all the fields which you need and also put a group by clause with any field available. This will generate all the code in the View file. I have updated the All Items view and grouped the items by one field.
2. Open the List in SharePoint Designer 2010 and open the view in which you need to modify this grouping. I am using the All Items view so I will make the changes in Allitems.aspx.
3. Locate the code which mentions the and there you will find a GroupBy Clause.
4. Edit the field for this and put it as:
5. Your final code will look like this:
<View Name="{A1737F54-FE3E-4527-81B9-51C58813F33B}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="All Items" Url="/Lists/DepartmentList/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png"> 
                    <GroupBy Collapse="TRUE" GroupLimit="30"> 
                        <FieldRef Name="ContentType"/> 
                        <FieldRef Name="ID"/> 
Post a Comment
Related Posts with Thumbnails