SharePoint Designer, List veiw filtered by a query string

This post might be useful for sharepoint designers who are using SharePoint Designer 2007.

It briefly describes how you can filter a list veiw by a query string. This might be useful when you have to show information for a single item
Create an aspx page through the SP 2007 designer.

Then add a zone Insert->SharePoint Controls->Web Part Zone within the 'PlaceHolderMain' content place holder

Velin Georgiev blog image

Click on the "Click to insert a Web Part" and then drag the list you wish to create a view in the zone. This will create list view web part within the zone.
Velin Georgiev blog image

You can choose a layout appropriate for showing the information on the page
Velin Georgiev blog image
Velin Georgiev blog image

Then you should convert the list view web part to XSLT data view. Right click on the list view web part and select "Convert to XSLT data View"
Converting to XSLT will aloud you to filter the view by query string parameter.
Velin Georgiev blog image

Open the XSLT data view menu and select "Parameters"
Velin Georgiev blog image

Create a new parameter and assign Query String as a Paremeter Source. You have to create a name of the Query string Variable as well.
Velin Georgiev blog image

Then select filter
Velin Georgiev blog image

You can find the parameter you have created at the bottom of the list of variables
Velin Georgiev blog image

I have created filter based on the ID column of the SharePoint List. This is how your filter may look like.
Velin Georgiev blog image

To test the filter, open your .aspx page in the browser and after the extension add ?ListID=some ID
Velin Georgiev blog image

In our case the data view should show information for one particular list Id
Velin Georgiev blog image

Thanks for your time!

Comments