Geeks With Blogs
Hani Amr


I've faced an interesting problem which I think must be resolved in the new version of Sharepoint. It's about filtering a data form webpart with a querystring parameter.Actually, when you provide a querystring it filters correctly, but if not then it'll not return any rows.

Which that was not the behaviour that I actually wanted, I needed it to display all rows when no querystring is applied. So, here's what I've done to work it around:

1. Drop a data form webpart on a page in Sharepoint Designer.
2. Open the code view for the page, find ParameterBindings section and add your parameter:

<ParameterBinding Name="QuerystringParam" Location="QueryString(ParamName)"/>

3. Then search the page for "<param" and then add a line with your parameter:

<Param name="QuerystringParam" />

4. Find the line where you're selecting the rows using xpath, and add an xsl filter like that :

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[@FilterField =$QuerystringParam]" />



And that's it :)



Posted on Wednesday, May 25, 2011 4:16 PM Sharepoint 2010 | Back to top

Copyright © H@Ni | Powered by: