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

[Solved] Filtering not working with non-numeric columns

1 Answer 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shane W.
Top achievements
Rank 1
Shane W. asked on 24 Jun 2009, 01:00 AM
I have a RadGrid which is bound to a LinqDataSource, which is in turn getting data from SQL via a DataContext.

Sorting works fine, but filtering behaves rather strangely-
I've enabled filtering using AllowFilteringByColumn="true".

1. If I filter based on just a numeric column like ID or quantity, it works the way it should. The filter applies.
2. If I filter only on a non-numeric column (I've tried string and datetime columns), it is as if I didn't apply a filter at all. I could put in a value of "sdfsadfsdgdsfgsafsafdasdfsdf" in the filter box, then choose "Equal To", and it still shows all records as if a filter hadn't been applied.
3. If I first apply a filter to a numeric column, say, the identiy column, it filters down to the one row. Great. If I then ADD a filter to another non-numeric column, all the rows show up again, even though I STILL have the filter set on the numeric column.

Here's a snip:

<asp:LinqDataSource ID="dsOrders" runat="server"   
        ContextTypeName="ChargebackDataContext" EnableInsert="True" 
        EnableUpdate="True" TableName="Orders" Where="Active = @Active or Active = true">  
        <WhereParameters> 
            <asp:SessionParameter SessionField="ActiveOnly" Name="Active" DbType="Boolean" DefaultValue="true" /> 
        </WhereParameters> 
    </asp:LinqDataSource> 
    <telerik:RadGrid ID="gridOrders" runat="server" AutoGenerateColumns="False" 
        DataSourceID="dsOrders" GridLines="None" Skin="Office2007" 
        AllowSorting="true" AllowPaging="true" PageSize="20" > 
        <HeaderContextMenu> 
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </HeaderContextMenu> 
 
        <MasterTableView allowautomaticinserts="true" allowautomaticupdates="true"   
                    commanditemdisplay="Top" datakeynames="OrderID" datasourceid="dsOrders" EditMode="PopUp" > 
            <CommandItemSettings AddNewRecordText="Add Order" /> 
            <CommandItemTemplate> 
            <table width="100%">  
            <tr> 
                <td align="left">  
                    <asp:Button runat="server" ID="btnInsert" CssClass="rgAdd" Text="Add Order" CommandName="InitInsert"/>  
                    <asp:LinkButton runat="server" ID="lbInsert" Text="Add Order" CommandName="InitInsert" /> 
                </td> 
                <td align="right">  
                    <asp:CheckBox runat="server" AutoPostBack="true"  Checked='<%# ShowActiveOnly %>' Text="Active Only" TextAlign="Right" ID="cbActiveOnly" OnCheckedChanged="cbActiveOnly_CheckedChanged" /> 
                </td> 
                <td align="right" style="width: 70px;">  
                    <asp:Button runat="server" ID="btnRefresh" CssClass="rgRefresh" Text="Refresh" CommandName="RebindGrid"/>  
                    <asp:LinkButton runat="server" ID="lbRefresh" Text="Refresh" CommandName="RebindGrid" /> 
                </td> 
            </tr> 
            </table> 
            </CommandItemTemplate> 
        <RowIndicatorColumn> 
        <HeaderStyle Width="20px"></HeaderStyle> 
        </RowIndicatorColumn> 
 
        <ExpandCollapseColumn> 
        <HeaderStyle Width="20px"></HeaderStyle> 
        </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"   
                    HeaderText="OrderID" ReadOnly="True" SortExpression="OrderID"   
                    UniqueName="OrderID">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="OrderDate" DataType="System.DateTime" AllowFiltering="false" 
                    HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PrimaryCustomer.CustomerName" DataType="System.String" 
                    HeaderText="Primary Customer" SortExpression="PrimaryCustomer.CustomerName"   
                    UniqueName="PrimaryCustomerAlias">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="SecondaryCustomer.CustomerName"   
                    HeaderText="Secondary Customer" DataType="System.String" 
                    SortExpression="SecondaryCustomer.CustomerName" UniqueName="SecondaryCustomerAlias">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="CCIOCode" HeaderText="CC/IO Code"   
                    SortExpression="CCIOCode" UniqueName="CCIOCode">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Service.ServiceName" HeaderText="Service" DataType="System.String"   
                    SortExpression="Service.ServiceName" UniqueName="ServiceName">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Quantity" DataType="System.Decimal"    
                    HeaderText="Quantity" SortExpression="Quantity" UniqueName="Quantity">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="OrderInstanceIdentifier.InstanceName" DataType="System.String" 
                    HeaderText="Instance" SortExpression="OrderInstanceIdentifier.InstanceName"   
                    UniqueName="OrderInstanceIdentifierName">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Notes" HeaderText="Notes" DataType="System.String" 
                    SortExpression="Notes" UniqueName="Notes">  
                </telerik:GridBoundColumn> 
                <telerik:GridCheckBoxColumn DataField="Recurring" DataType="System.Boolean"   
                    HeaderText="Recurring" SortExpression="Recurring" UniqueName="Recurring">  
                </telerik:GridCheckBoxColumn> 
                <telerik:GridCheckBoxColumn DataField="Active" DataType="System.Boolean"   
                    HeaderText="Active" SortExpression="Active" UniqueName="Active">  
                </telerik:GridCheckBoxColumn> 
                <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> 
            </Columns> 
            <EditFormSettings EditFormType="WebUserControl" UserControlName="Components/OrderEditForm/OrderEditForm.ascx"><PopUpSettings Width="600px" /> 
            </EditFormSettings> 
        </MasterTableView> 
 
        <FilterMenu> 
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        </FilterMenu> 
    </telerik:RadGrid> 

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 25 Jun 2009, 08:11 AM
Hello Shane W.,

I tried to replicate the issue with the filtering you depicted (performing similar steps)  in a sample project based on this demo but unfortunately to no avail. Can you please outline the differences between your grid configuration and the one used in the live example? They can help us determine the reason for the erroneous behavior and how to address it.

Kind regrads,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Shane W.
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or