9 04 2010
SharePoint QuickTip – Filtering by the current User in a Data View WebPart?
QuickTip
Displaying a DataViewWebPart of a List with a column of type “Person or Group”? Want to filter that list by the current user?
Simple!
Dive into to Code View, locate the XSL Stylesheet and find the dvt_apos parameter declaration. Add in the UserID parameter just after it, so the 2 lines look like this:
1 |
<xsl:param name="dvt_apos">'</xsl:param><br><xsl:param name="UserID" /><br><br> |
Next, open up the Common DataView Tasks smart menu, and select Filter… open up the XSLT Filtering dialogue and add this:
1 |
substring-after(@Owner,'#') = $UserID<br> |
Replace “@Owner” with the field in the list that contains the Person or Group. Save out, log in as another user and voilá!
You can also use the $UserID variable to display the current user’s Display Name somewhere on the page!
SharePoint QuickTip – FileDirRef – Your Friend for a Better User Experience SharePoint – "New" Image Graphic – Identify New Content to Users