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

Coding CQWP with Dynamic Filtering

$
0
0

Hi All,

I had deployed CQWP (with one drop-down list control) pointing to a Single Custom List. I have done this by extending the ContentByQueryWebPart class. I have to filter the items based on the user selected value from the drop-down. The thing is on choosing the value from the drop-down, I'm setting the Query Override property of CQWP  and can be able to see the given query value on exporting the webpart. The thing is am not able to view the results, same result (# of items) is getting for every query value. The question is after setting the queryoverride property. How to tell the CQWP to refresh or to process the new data from the given query value? The below is my drop-down list's select Index changed method.

 protected void myEntityList_Changed(object sender, EventArgs e)
        {

           string query = string.Empty;

           switch (myEntityList.SelectedIndex)
            {
                case 0:   query = "CAML query with condition for opt - 1";                         break;
                case 1:   query = "CAML query with condition for opt - 2";                         break;
            }
            this.QueryOverride = query; // this is the object of my current CQWP.
            this.SaveProperties = true;
            this.SaveControlState();
            this.SaveViewState();
            this.DataBind();
        }

Dynamic Filtering on PageField & QueryField methods please excuse.

Please, help me to get the new items on each selection of the drop-down list? 

TIA.


Naren.


Viewing all articles
Browse latest Browse all 25064

Trending Articles



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