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

GridView Filtering issue

1 Answer 38 Views
GridView
This is a migrated thread and some comments may be shown as answers.
CARLOS NEVES
Top achievements
Rank 1
CARLOS NEVES asked on 08 May 2013, 10:12 AM
Hello,

I'm having an issue with a gridview filter when I use a RadTabControl. What hapens is that when I click a button on a tab, I want to filter the grid that's in the other tab, so when I click that button, I change the selected tab to the one that contains the grid, and execute the filter method (this filter is done using IColumnFilterDescriptor). What happens is that the filter is set on the column but it's not active, and we have to change the filter on the UI (mouse click) of that same column for it to be applied. Bellow is the code sample of my filtering method.

public void Filter()
        {
 
            foreach (var c in this.myGrid.Columns)
            {
                if (c.ColumnFilterDescriptor.IsActive)
                {
                    c.ClearFilters();
                }
            }
 
            GridViewColumn column = this.myGrid.Columns["ID"];
            // Getting it from the property will create it and associate it with its column automatically.
            IColumnFilterDescriptor columnDescriptor = column.ColumnFilterDescriptor;
            columnDescriptor.SuspendNotifications();
            columnDescriptor.FieldFilter.Filter1.Operator = FilterOperator.IsGreaterThanOrEqualTo;
            columnDescriptor.FieldFilter.Filter1.Value = 10;
            columnDescriptor.ResumeNotifications();
        }


Thanks,

Renato Vale

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 May 2013, 11:28 AM
Hi Renato,

You say that you change the selected tab to the one that contains the GridView and execute the filter method. Would you please ensure that the Tab has been changed and the GridView is available before applying the filter. A simple test that you could do is to place invoke the Filter method on a button's click (having the button on the second TabItem). You could as well set the IsContentPreserved property for the RadTabControl, so that the content is preserved when switching between the tabs.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
CARLOS NEVES
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or