Scenario: I was trying to check a column value in splistitem in an Asynchronous event handler.
Since it is asynchronous, the values had already changed & the before state is unaccessible through properties object.
Problem: How to get GUID of a SPListItem so that you can access list item values before the event handler updates it
We have to display data in a Content Query WebPart from a SharePoint list & apply two level grouping to it. Below is an example of two level grouping.
We have three columns in the list namely FoundationName, CauseName & FundName. We need to group the data first by FoundationName & then by Causename. Below is an example of how the data should look like in the end.
Foundation1
Cause1
Fund1
Fund2
Fund3
Cause2
Fund4
Foundation2
Cause1
Fund5
Cause3
Fund6
Solution:
Step 1:
In order to understand how SharePoint renders the Content Query Web Part, let's look at the Raw Xml
Refer to: http://www.sharepointblogs.com/radi/archive/2009/03/17/content-query-web-part-getting-a-full-dump-of-the-raw-xml.aspx
Below is the raw Xml I got when i connected to my list:
Since we have to group our data, we will be coding in ContentQueryMain.xsl. (Note: It is a good practice to create your own custom ContentQueryMain file & make your CQWP reference to this file.)
In ContentQueryMain.xsl, replace
<xsl:template match="/">
<xsl:call-template name="OuterTemplate" />
</xsl:template>
with
<xsl:template match="/">
<xsl:call-template name="OurCustomTemplate" />
</xsl:template>
Step 3:
We will be using Keys for creating two level grouping. Two keys in our case: