Using Querystrings in DataForm Webparts
One of the customisations we did for a recent Sharepoint project was to filter a Data Form webpart based on values supplied from the Querystring.
To make your DataForm accept values from the Querystring, try the following:
1. Open your Sharepoint site using Sharepoint Designer.
2. Create a new page and drop in a DataForm webpart.
3. Bind the DataForm webpart to any of the available lists.
4. Now switch to the Code view and locate the HTML code rendering the webpart control. Under the <ParameterBindings> tag, look for
<ParameterBinding Name="filterParam" Location="Postback;Connection"/>
5. Change this to
<ParameterBinding Name="filterParam" Location="Postback;Connection;QueryString(myField)"/> where myField is the name of the Querystring paramater you want to supply.
6. Now, switch back to Design view, select the DataForm webpart, and open the "Data View" menu (Alt+D) and select the Filter.
7. A filter criteria box shows up. Choose the column that needs filtering in "field name" and select [Input Parameter] in Value and close the filter dailog box.
The Dataform webpart will now be ready to accept values from the querystring. To test this, load the page and pass a querystring.
http://mysite/samplepage.aspx?myField=xxxx
No comments:
Post a Comment