Site icon @WonderLaura

Query String URL & Data View Web Parts (Part 3 of 4)

In the last two posts of this series, I showed you how to use the MOSS Enterprise out of box web part called the Query String (URL) Filter.  This post will show you how to accomplish the same thing, but without MOSS.  This entails using the data view web part.  I’ll use the same example of a project details page.  The query string will be used to pass the project ID to each of the data view web parts on a page.

Even if you DO have MOSS, another good reason to use data view web parts for mash-ups, is that redundant column that you’re connecting to.  You know how when you’re creating web part connections, the only columns available for the connection are the ones that are being displayed in the web part? When data view web parts are used, ALL list fields are available in the connection, not just the displayed ones!

Here’s how to configure each web part in SharePoint Designer, to use a Query String:

  1. Create a blank web part page, and open it in SharePoint Designer.  Insert a data view web part, we’ll just start with the issues list.  Again, this is using the same project details example, so please read my last post about it.
  2. In the Data View menu in the toolbar, click Parameters.
  3. There will already be one parameter.  Add a new Query String parameter, called “ProjParam”, like this:
    ch7[9]
  4. In the Data View menu in the toolbar, click Filter.
  5. Create a filter where the ProjID field is equal to the new parameter [ProjParam]:
  6. Save the page.  Make sure there are a couple of items in the list, each with a ProjID associated with them.  Open the web part page in the browser and test the query string.

The trick is that now you use the URL in order to pass the project number to this web part.  This is supposed to be a project mash-up, so add all of the associated lists to the page as data view web parts, and repeat steps two through five on each one.

The URL to the page will now end with the page name.aspx?Project=2

That red number is unique to each project.  In my previous post, I showed how to create the workflow that generates that project details URL for each new project.  This screenshot shows that this list is automatically filtered by issues that have a ProjID field equal to one, because of the URL.

In summary, here’s a brief comparison:

Query String (URL) Filter Web Part
  • Out of box web part
  • No SharePoint Designer needed
  • MOSS Enterprise version needed
Data View Web Part With Query String
  • SharePoint Designer data view web part creation needed
  • More complex setup
  • Can be done in just WSS, without MOSS

Note that you can still create all data view web parts, and still use the Query String URL Filter Web Part.  This combination method will let you get rid of all of the redundant columns, in this case the ProjID… with the ease of use of the out of box query string URL filter web part.

Here are the other parts in this series:


Exit mobile version