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

Filter operator list

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul Taylor
Top achievements
Rank 1
Paul Taylor asked on 05 Apr 2011, 09:18 PM
I have a column in a RadGrid that has a customised Filter control. Rather than the standard text box, I have used the column's FilterTemplate to display a RadCombo list containing possible filter values. I have a couple of questions relating to this scenario.

In addition to the list, I would like to show the standard list of filter operators that normally appears next to the text box in filter controls. Does a control exist to implement this feature? How is it configured?

When the user selects a value from the list, in code-behind the filter is applied and the grid is rebound. As a result, the combo is repopulated and its SelectedValue property is initialised to null. However, I want the SelectedValue property to be set to the value the user has just selected, so that selecting all other items in the list produces the appropriate re-filtering action. How can I do that?

Suggestions welcome, thanks in advance!


                <telerik:GridBoundColumn DataField="CaseStatus" FilterControlAltText="Filter status column"
                    HeaderText="Case Status" UniqueName="Status">
                    <FilterTemplate>
                        <telerik:RadComboBox runat="server" ID="ddlStatus" AutoPostBack="true"
                                      OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged">
                        </telerik:RadComboBox>
                    </FilterTemplate>
                </telerik:GridBoundColumn>


        protected void ddlStatus_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            string filterExpression = string.Format("CaseStatus = {0}", (byte)Enum.Parse(typeof(CaseStatus), e.Value));
            rgResults.MasterTableView.FilterExpression = filterExpression;
            rgResults.MasterTableView.Rebind();
        }

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 08 Apr 2011, 03:45 PM
Hello Paul,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

Kind regards,
Mira
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
Paul Taylor
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or