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

Filtering with StartsWith and Entities using NeedDataSource

2 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Curtis asked on 09 Jul 2011, 06:53 AM
I am using NeedDataSource to databind a RadGrid to a collection of Entities using the Entity Framework 4.

protected void dgPerson_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            dgPerson.DataSource = LocalEntityManager.Context.People;
        }

That all works fine but the StartsWith and EqualTo filter option do not return any rows. I have tried setting EnableLinqExpression to true and false but it makes no difference. There are 65,000 objects in this list of people objects. Could it be that is too many to filter by?

<telerik:RadGrid ID="dgPerson" runat="server"
        AllowFilteringByColumn="True"
        AllowSorting="True"
        AllowPaging="true"
        PagerStyle-Mode="NextPrevNumericAndAdvanced"
        GridLines="None"
        OnNeedDataSource="dgPerson_NeedDataSource"
        EnableLinqExpressions="true"
        ShowStatusBar="true"
        Skin="Black">
    <MasterTableView 
        Name="Person"
        autogeneratecolumns="False"
        CommandItemDisplay="Top"
        datakeynames="PersonID"
        pagesize="20"
        EditMode="PopUp"
        EditFormSettings-PopUpSettings-Modal="false"
        EditFormSettings-PopUpSettings-Width="950px">
    <RowIndicatorColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>
    <ExpandCollapseColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
    <SortExpressions>
        <telerik:GridSortExpression FieldName="FullName" SortOrder="Ascending" />
    </SortExpressions>
    <Columns>
        <telerik:GridBoundColumn DataField="PersonID" DataType="System.Int32" FilterControlWidth="40px"
            HeaderText="ID" ReadOnly="True" SortExpression="PersonID" UniqueName="PersonID">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn HeaderText="Full Name" SortExpression="FullName" UniqueName="FullName" DataField="FullName" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith">
            <ItemTemplate><asp:Literal runat="server" ID="litFullName" Text='<%# Eval("FullName") %>'></asp:Literal></ItemTemplate>
            <EditItemTemplate><asp:TextBox runat="server" ID="txtFullName" Width="300px" Text='<%# Bind("FullName") %>'></asp:TextBox></EditItemTemplate>
        </telerik:GridTemplateColumn>

2 Answers, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 11 Jul 2011, 03:34 PM
Hi Curtis,

Are the other filtering options working correct?
This could be a case sensitivity issue if the first letter in your records is in upper case and you write the text in filter in lower case.
Try to set CaseSensitive="false" in the GroupingSettings of the grid.

Regards,
Vasil
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Curtis
Top achievements
Rank 1
answered on 11 Jul 2011, 03:50 PM
That was it. Thanks!
Tags
Grid
Asked by
Curtis
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Curtis
Top achievements
Rank 1
Share this question
or