GridTemplateColumn with FilterTemplate when AllowFiltering=true causes an error.

2 posts, 0 answers
  1. Greg S
    Greg S avatar
    8 posts
    Member since:
    Jul 2015

    Posted 30 Jul 2016 Link to this post

    After a few hours of searching the internet on the error "Specified argument was out of the range of valid values", I discovered that the cause was the GridTemplateColumn behaving differently that a GridBoundColumn with regards to filtering. In the code snippet below, you can use the one filter just fine. If you change the telerik:GridTemplateColumn (column 2) to AllowFiltering='true' while having a <FilterTemplate> element, using the filter on column 3 will throw an error. AllowFiltering='true' doesn't cause a problem if there's no <FilterTemplate> element. Note that changing the GridBoundColumn ( column 1) between AllowFiltering= true/false doesn't cause an issue. It's only the GridTemplateColumn type.

    The different behavior between the GridBoundColumn and GridTemplateColumn types seems like a bug.


          <telerik:RadGrid runat="server" DataSourceID="sql_tables" AllowFilteringByColumn="true" AutoGenerateColumns="false">
                        <telerik:GridBoundColumn DataField="name" HeaderText="name" AllowFiltering="true" UniqueName="name1">
                                custom filter template on GridBoundColumn is OK
                        <telerik:GridTemplateColumn DataField="name" HeaderText="name-template" AllowFiltering="false" UniqueName="name2">
                                <%#Eval("name") %>
                            <FilterTemplate>custom filter on GridTemplateColumn breaks filtering.</FilterTemplate>
                            <HeaderStyle BackColor="Pink" />
    <telerik:GridBoundColumn DataField="type" HeaderText="type" AllowFiltering="true" UniqueName="type"/>
            <asp:SqlDataSource runat="server" ID="sql_tables" ConnectionString="<%$ ConnectionStrings:MyDB%>" SelectCommand="select top 4 name, object_id, schema_id, type, type_desc from sys.tables" />

  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 03 Aug 2016 Link to this post

    Hi Greg,

    The same scenario is presented in the online demo below and works properly without an error:

    Test it on your end and verify what the difrenace in your case is.

    Maria Ilieva
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top