Filtering with StartsWith and Entities using NeedDataSource

3 posts, 1 answers
  1. Curtis
    Curtis avatar
    26 posts
    Member since:
    Jan 2008

    Posted 09 Jul 2011 Link to this post

    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"
            <HeaderStyle Width="20px"></HeaderStyle>
            <HeaderStyle Width="20px"></HeaderStyle>
            <telerik:GridSortExpression FieldName="FullName" SortOrder="Ascending" />
            <telerik:GridBoundColumn DataField="PersonID" DataType="System.Int32" FilterControlWidth="40px"
                HeaderText="ID" ReadOnly="True" SortExpression="PersonID" UniqueName="PersonID">
            <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>
  2. Answer
    Vasil avatar
    1604 posts

    Posted 11 Jul 2011 Link to this post

    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.

    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!

  3. Curtis
    Curtis avatar
    26 posts
    Member since:
    Jan 2008

    Posted 11 Jul 2011 Link to this post

    That was it. Thanks!
Back to Top