0
votes

I have created ASPX page and have used Data view webpart on it. I am trying to filter list items based on user Logon information without domain.

I have created a parameter(LOGON) and assigned server variable LOGON_USER (this gives me username as "Domain\username")

I basically want to filter list item( On column/field called user_names in list) based on "username" only and not checking domain with it.

As while filtering, I can only set list item field to be equal to parameter. I am thinking of creating another parameter and assign the value of that parameter to be substring-after($Logon,'\') but I am not able to do that in SharePoint Designer. I was also trying it through xslt filtering but that doesn't work too as that happen after data source gets created.

1

1 Answers

0
votes

Use javascript to get the user name or to trim the user name before you send it to the URL as a parameter. Then the DVWP data source can be filtered correctly.

Or, use XSLT filtering, which indeed DOES work. You just need to know where to put it. Keep in mind that with XSLT filtering the data for all users will be returned by the query and the filter will only affect the rendering.

<xsl:template name="dvt_1">
    <xsl:variable name="dvt_StyleName">Table</xsl:variable>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[@UserName = $Logon]" /> 

Adjust to reflect your field names.