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

The default filter function changes to 'No Filter' on second filtration for RadGrid Column

1 Answer 231 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Smruti Ranjan
Top achievements
Rank 1
Smruti Ranjan asked on 02 Apr 2012, 04:24 PM

I have a RadGrid in my page.

For a particular string type column i had set the default filter function as "Contains".

On first page load i found that it appears as "Contains" in the Filter menu.
But if lets say, i filter any other column with any filter criteria and again come back to this column and open the filter menu the default filter function now automatically changed to "No Filter".

Many work arrounds i had tried but is not working for me, cant even found the exact cause for it.

Can any body help me in this regard ? I want to know why it happens like this and what may be the fixes for this ?

Thanks in advance. :)

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Apr 2012, 07:32 AM
Hello Smruthi,

The default behavor for the grid is not to persist the CurrentFilterFunction on postback for columns that do not have value entered in the filter. You can try manually saving this setting. One approach is to set the CurrentFilterFunction property in the Page_PreRender event for the page. Here is the sample code.
aspx:
<telerik:GridBoundColumn DataField="FirstName"  CurrentFilterFunction="Contains"   UniqueName="FirstName" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EmployeeID"  UniqueName="EmployeeID" >
</telerik:GridBoundColumn>

C#:
protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);
    grid1.Columns[0].CurrentFilterFunction = GridKnownFunction.Contains;
    grid1.Rebind();
}

Thanks,
Shinu.
Tags
Grid
Asked by
Smruti Ranjan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or