1
votes

The Idea:

I would like for the List View Web Parts on my Sharepoint page to render without taking into account the extra Query String that a user may input into the url.

My Particular Situation:

If someone adds a filter at the end of the url like
http://mysite/Blog/default.aspx?FilterField1=Main%5Fx0020%5FCategory&FilterValue1=Category1

...then all list view web parts regardless of which list they're pointing to will filter by those columns specified in the url.

Desired Outcome:

I would like certain list view web parts on that site to not be filtered by the indicated columns, whilst others can be filtered.

So in essence, I also want to be able to pick and choose which Web Part will allow the Additional Query String and which ones will not allow it.

Some Notes:

I'm not trying to create a custom Web Part, I'm using a List View Web Part and the best customization I can do is through Sharepoint Designer.

The reason for this is that I would like to save the resulting site as a template and use it in other Sharepoint servers without the need to upload a custom Web Part. (I do realize everything is super easy to solve with a custom Web part)


Alright, the view parameter DOES work :)

However, I didn't expect the answer to be this, so I'll have to add more to my situation.

New Situation

This URL will not be entered manually, I'm actually using xsl to automatically generate this url. Since I will be transferring this site (by template) to a new server at some point, I can't hardcode the GUID because it shouldn't be the same on the new site. Thus, is there some xsl code to find the GUID of the Default View of a List? OR, can I somehow use the actual Name of the View in the url?

My current xsl code

This is contained in a WebPart that has a different view than the one I need in the url

<a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/AllPosts.aspx?FilterField1=Main%5Fx0020%5FCategory&amp;FilterValue1={substring-after($thisNode/@Main_x0020_Category., '#')}">

Notes

The view I need is the default view, in case that makes anything easier

2

2 Answers

0
votes

You can try the View parameter:

http://mysite/Blog/default.aspx?View={A6D1D37F-25CB-473C-8B84-361829F0D96E}&FilterField1=Main%5Fx0020%5FCategory&FilterValue1=Category1

This should limit the filter to only web parts that use that specific view. Otherwise, you will probably need to create a custom web part.

0
votes

Okay! I've found the answer!

Background

I'm not sure how useful it will be to others, but my situation involved me needing to group a list by certain columns and then link the group headings (column values) back to the same page with a filter in the url.

This would filter the main list (in a seperate webpart and different view) containing the elements but was supposed to NOT filter the Grouped Webpart (Navigation).

All this time I was using ListViewWebParts (xsl name = XsltListViewWebPart) and so I had the problem I specified.

Answer

Randomly, as I was searching around for a way to group lists by more than 2 columns (a view created in sharepoint limits you to 2), I came across a post that shows you how to add a DataViewWebPart (xsl name = DataFormWebPart), which is only able to be inserted using Sharepoint Designer and allows more than 2 group-by columns.

A side effect of this webpart, since it is only able to be added through designer, is that nothing can be manipulated, pertaining to the view, at runtime. This means the url does not affect what you see in this webpart!

Resources

Here are some links to the sites I needed to deal with this new webpart

http://techtrainingnotes.blogspot.com/2011/01/sharepoint-group-by-on-more-than-2.html

http://www.jwc3.net/2008/05/how-to-get-url-in-xsl.html