This is a migrated thread and some comments may be shown as answers.

dropdown Filter on multiple values

1 Answer 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 19 Oct 2010, 08:19 PM
Hi,

I have implemented a dropdown filter for the status column in the grid displaying requests
there are 5 status values. 

New
Open
In-Process
Resolved
Closed

I am able to filter the grid based on the drop down by selected one of the above values using the following code

protected void cbStatusFilter_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
       {
           GridFilteringItem filterItem = (GridFilteringItem)grdRequests.MasterTableView.GetItems(GridItemType.FilteringItem)[0];
           Status = e.Value;
           (filterItem.FindControl("txtStatus") as TextBox).Text = e.Value;
           if (e.Value != "")
           {
               filterItem.FireCommandEvent("Filter", new Pair("EqualTo", "Status"));
           }
           else
               filterItem.FireCommandEvent("Filter", new Pair("NoFilter", "Status"));
       }
 
            private string Status
       {
           get
           {
               if (ViewState["Status"] == null)
                   return "";
               else
                   return ViewState["Status"].ToString();
           }
           set { ViewState["Status"] = value; }
       }

 What I want to be able to do is add an additional value in the dropdown called Unresolved which when selected should show requests with New, Open, and In-Process status. I am not sure how to go about implementing this.



How do I call the FireCommandEvent to filter by multiple values i.e New, Open, In-Process
thanks



1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 25 Oct 2010, 09:39 AM
Hi Jay,

To implement filtering by multiple values in a single field, you need to set a custom FilterExpression to the MasterTableView (or the table you are filtering). You can refer to the RadGrid FilterExpression property API on how to set the FilterExpression in a proper format.

Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Jay
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or