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

Automatic filter on telrik grid with auto generated column

1 Answer 373 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anuj
Top achievements
Rank 1
Anuj asked on 13 Mar 2012, 02:35 PM
Is there any way to apply excel like automatic filter on telrik grid ? I have autogeneratedcolumn=true and based on condition I am showing the column 


<telerik:RadGrid ID="gvinvoice" Width="98%" AllowPaging="true" PageSize="10" runat="server"
                                AutoGenerateColumns="true" 
                                OnPageIndexChanged="gvinvoice_PageIndexChanged" 
                                ShowFooter="True">
                                <PagerStyle Mode="NextPrevAndNumeric" />
                            </telerik:RadGrid>


So, at design time I am not sure the number and name of the column. How can I apply filter to these columns ? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Mar 2012, 02:58 PM
Hello,

I guess you want to enable filtering option for AutoGeneratedColumns in RadGrid. If so you can easily achieve this by setting AllowFilteringByColumn="true" property for RadGrid . Please elaborate your requirement more if it doesn’t help.

Thanks,
Princy.
Boris
Top achievements
Rank 1
commented on 16 Dec 2021, 02:59 AM | edited

how do u set

CurrentFilterFunction="EqualTo" 

on all auto-generated columns?
Doncho
Telerik team
commented on 20 Dec 2021, 02:31 PM

Hi Boris, 

You should be able to use the GridCreated event as shown in the Customizing auto-generated columns.

For instance:

protected void RadGrid1_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
{
    var col = e.Column;
    col.AutoPostBackOnFilter = true;
    col.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.EqualTo;
}
Please give it a try and let me know how it goes.

Tags
Grid
Asked by
Anuj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or