Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 78072

GridTemplateColumn with FilterTemplate when AllowFiltering=true causes an error.

$
0
0

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:RadGridrunat="server"DataSourceID="sql_tables"AllowFilteringByColumn="true"AutoGenerateColumns="false">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumnDataField="name"HeaderText="name"AllowFiltering="true"UniqueName="name1">
                        <FilterTemplate>
                            custom filter template on GridBoundColumn is OK
                        </FilterTemplate>
                    </telerik:GridBoundColumn>
 
                    <telerik:GridTemplateColumnDataField="name"HeaderText="name-template"AllowFiltering="false"UniqueName="name2">
                        <ItemTemplate>
                            <%#Eval("name") %>
                        </ItemTemplate>
                        <FilterTemplate>custom filter on GridTemplateColumn breaks filtering.</FilterTemplate>
                        <HeaderStyleBackColor="Pink"/>
                    </telerik:GridTemplateColumn>
 
<telerik:GridBoundColumnDataField="type"HeaderText="type"AllowFiltering="true"UniqueName="type"/>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
 
        <asp:SqlDataSourcerunat="server"ID="sql_tables"ConnectionString="<%$ ConnectionStrings:MyDB%>" SelectCommand="select top 4 name, object_id, schema_id, type, type_desc from sys.tables" />

Viewing all articles
Browse latest Browse all 78072


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>