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

[Solved] Grid filter column's SelectedIndexChanged() fires after Grid's OnNeedDataSource(), when EnableViewState=False

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Helm
Top achievements
Rank 1
Robert Helm asked on 25 Apr 2013, 01:53 PM
I recently upgraded to 2013.1.403.40. Since then, a page has stopped filtering a Grid correctly.
  • The Grid has EnableViewState = False.
  • The Gird has GridBoundColumns containing RadComboBoxes that are used to filter the Grid when the RadComboBox's SelectedIndexChanged() fires.

This was working OK before the upgrade.

I've observed that once the RadComboBox is changed to filter the Grid, instead of the SelectedIndexChanged event firing and then the Grid's OnNeedDataSource event, the opposite occurs. So the RadComboBox value needed to filter the Grid isn't there.

I know from documentation that "If ViewState optimization is enabled, RadGrid will fire NeedDataSource and will bind after each post back to restore its items....RadGrid and its TableView manage the state of the following features while the EnableViewState property is set to False: ...Filter expressions(but not the filter value in the input control)..."

Note that I use a local class to store the value of the RadComboBox, which is then accessed to filter the grid in OnNeedDataSource .

I guess I'm wondering if this is a new bug, or one that was fixed and now my code is wrong.

Thanks for any info,
Robert



1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 30 Apr 2013, 11:50 AM
Hello Robert,

Without your code declaration it will be hard to determine the reason for that behavior. What you could suggest you is to call Rebind() OnSelectedIndexChanged. This way the OnNeedDataSource will be fired again. For instance:
protected void FilterCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
    string filterExpression;
    filterExpression = "([CategoryName] = '" + e.Value + "')";
    RadGrid1.MasterTableView.FilterExpression = filterExpression;
    RadGrid1.MasterTableView.Rebind();
}

I hope this information helps.

Greetings,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Robert Helm
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or