Query String Parameter Value in CAML

Topics: Enhanced Blog Edition
Aug 24, 2009 at 8:20 PM
Edited Aug 25, 2009 at 1:11 PM

Is it possible to pass a parameter value from the query string in the URL to the CAML query in the SingleListQuery control?

I have a parameter called "month". Adding QS in XSLT is simple enough, but I can't seem to find the right method for using the value in my query.

The query is listed below (from the QueryXML property) with the method that I'm used to.

 

<Where>

<Contains>

<FieldRef Name='monthAndDate'/>

<Value Type='Text'>{month}</Value>

</Contains>

</Where>

<OrderBy>

<FieldRef Name='publishedDate' Ascending='FALSE'/>

<FieldRef Name='Title' Ascending='TRUE'/>

</OrderBy>

If I replace the "{month}" with a known value then everything works but otherwise it just returns empty.

I have used this method with the DataView Webpart so naturally this is where I started.

Sep 24, 2009 at 4:27 PM

Dear Arknev,

I have a similar problem, in lieu of being able to get in to the nuts and bolts and source code of the project, I am quite keen to use the extensible features such as SingleListQuery. The problem I have is as follows. The CKS:EBE PostList replies a subset of data which is quite strict. This is used on Home.aspx and Category.aspx. I can modify the results of Post.aspx and Home.aspx by simply pointing the results at the CKS:EBE List method and using XSL. However, I wanted to get a consistent view across the results with all aspx pages by adding one or two more core fields and rendering via XSL which included the category function. My problem is this, I cannot based on the fields returned by the postlist method get this result whilst ideally using the code behind this function to filter on the query string for the categories.

I therefore tried to use the SingleListQuery and CAML function but cannot seem to get the automatic filtering based on the query string when a tag cloud item is selected. I have looked at many posts and can get basic sorting / etc working via CAML but not an automated filter based on the query string as done in PostList.cs

Any help on this or how to grab this variable and pass it into the CAML rather than using the code behind would be greatly appreciated.

Regards

D