I have a Data Form Web Part (DFWP) in SP2010 and need to filter one of the columns ("Department") on a value using the querystring. How do you do this?
1 Answer
Open the web part page that contains the web part in question.
In the web part parameters in Sharepoint Designer, you create a new query string parameter. Then you filter the web part so that your desired column is filtered by that parameter. Then you pass in the desired value in the query string and you should get the desired results.
-
2Adding to Eric's answer above, you can do everything he describes with the common dialogs.Marc D Anderson– Marc D Anderson2011-07-14 14:04:47 +00:00Commented Jul 14, 2011 at 14:04
-
Thanks, PirateEric. I navigated to the web part in Designer via Site Objects > All Files > _catalogs > wp. Then clicked on it, and chose "Edit File". However, it shows only the code view and there are no options for adding parameters (or much else). What am I doing wrong? Thanks.Alex C– Alex C2011-07-14 14:05:56 +00:00Commented Jul 14, 2011 at 14:05
-
1Open the page the web part is on and edit the web part there, not the web part from the catalogs folder.Eric Alexander– Eric Alexander2011-07-14 14:08:56 +00:00Commented Jul 14, 2011 at 14:08
-
Okay. Thanks, PirateEric. Got to the parameter. However, the column I'd like to filter on has a space in it:
"Infoweb Department". I've tried using"Infoweb_x0020_Department"and"Infoweb Department"for the Querystring name and setting the default value as"Accommodations", but the web part is replaced with"The server returned a non-specific error when trying to get data from the data source."What am I doing wrong?Alex C– Alex C2011-07-14 14:23:28 +00:00Commented Jul 14, 2011 at 14:23 -
1When you define the QS parameter, the name you give it is what you use in the Filter dialog box, so Infoweb Departmet equals [param1] for example. The query string variable is what the web part will be looking for in the url, dept for example. So I'd end up passing in something like ...MyPage.aspx?dept=IT and this should show a filtered list of all IT listings in the Infoweb Department column.Eric Alexander– Eric Alexander2011-07-14 15:10:09 +00:00Commented Jul 14, 2011 at 15:10