Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Problem passing filters to XSLTListViewWebPart through Querystring and Form Parameters

$
0
0

Hi,

I have an XSLTListViewWebPart, defined on a list.

What I need to do is to set up custom filters from a custom webpart (MyWebPart) which resides on the same page (say /MyPage.aspx). To keep it simple I decided to pass a parameter containing a CAML Query from MyWebPart to the ListView.

So far it works well with Querystring parameter, since I am able to pass a CAML Query to the ListView through a call like:

http://mysite/MyPage.aspx?filter=MyCAMLQuery.

Passing the whole CAML query by querystring is not the best thing to do because the query remains visible in the address, which I do not want to. So I’m trying to pass the same parameter as a Form parameter with a POST:

 

<ParameterBinding Name="MyFilter" Location="Form(IDMyHiddenField)" DefaultValue=""/>

Therefore I added a HiddenField WebControl to MyWebPart and set its value with the CAML query just as I did with the querystring.

The problem is that the ListView expects an object with id = “IDMyHiddenField” which is the server ID I give to my control, and not the ClientID (which is read only)

<input type=”hidden” ID=”serverStuff_IDMyHiddenField” value=” MyCustomCAMLQuery” />

As the serverStuff part of the ClientID of the control is not a fixed value I can’t write it in the Location for my Form parameter.

Is there a way to get around this ClientID thing?


Plo

Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>