using QueryOverride in ECQWP

Jul 13, 2007 at 9:24 AM
HI

Can we use the queryoverride feature using this code.I know that we don't hv any properties exposed for is as yet,bt wt if we expose one such property in it.
Then within our code can we set like webpart.QueryOverride="<Where><And><Geq><FieldRef Name='EventStartDate' /><Value Type='DateTime'><Today/></Value></Geq><Lt><FieldRef Name='EventStartDate' /><Value Type='DateTime'><Today OffsetDays='7'/></Value></Lt></And></Where>]]"

Will this work??
My requirement is such that i want to show the documents which are modified either today or within last 7 days.

Thanks in advance
Amit
Sep 15, 2009 at 4:55 AM

HI

did you find how to include CAML in the queryoverride property.. please let me know thanks a lot...

Sep 15, 2009 at 5:56 AM

HI Naresh,

Yeah, i have done it in 1 of the webparts i developed.

I created a webpart and its toolpart class( as we required custom filters alongwith OOB CQWP filters).

This webpart inherits from BaseByContentQuery webpart.

Override the query on init event of this webpart like

this.queryoverride="<CAML QUERY>";

Simlarly override this query on ApplyChanges of toolpart class

this.queryoverride="<CAML QUERY>";

 

Amit

 

 

Jun 25, 2010 at 4:46 AM
Edited Jun 25, 2010 at 4:47 AM
tutejaamit5 wrote:

HI Naresh,

Yeah, i have done it in 1 of the webparts i developed.

I created a webpart and its toolpart class( as we required custom filters alongwith OOB CQWP filters).

This webpart inherits from BaseByContentQuery webpart.

Override the query on init event of this webpart like

this.queryoverride="<CAML QUERY>";

Simlarly override this query on ApplyChanges of toolpart class

this.queryoverride="<CAML QUERY>";

 

Amit

 

 

 

 

Hi Amit,

 

I tried the same but i am getting the below error when I click On "Apply “and then when i click "Ok" in the tool part.

 "Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request."

 Please any one let me know if i am missing something or I need to do any extra steps to resolve this error. Need a solution very urgently.. Pls someone Help.......

 

 

 

 

 

 

Jun 25, 2010 at 5:48 AM

Hi Varun,

 

Please ensure that you are overriding the query on Init event of webpart.