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

[Solved] unable to search by * in filter

2 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 09 Aug 2013, 06:52 PM
I have a rad grid which allows filtering by column. Everything works fine except that in one column I have several records with values that start with "*". When I search by * I get all rows back an not the rows starting with *. If I enable linq expressions then searching by * works but then case insensitive searching no longer works.
I think RadGrid is using * as a shortcut indicator to do a "starts with" search. How can I get the filter to search for *?

Thanks,
Chris

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 12 Aug 2013, 06:31 AM
Hello,

Can you please try with the below code snippet?

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
        AutoGenerateColumns="False" AllowFilteringByColumn="true" EnableLinqExpressions="false">
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
   {
 
       dynamic data1 = new[] {
              new { ID = 1, Name ="**Name_1", Status = false},
              new { ID = 2, Name = "*Name_2", Status = true},
              new { ID = 3, Name = "Name_1", Status = false},
              new { ID = 4, Name = "Name_4", Status = true},
              new { ID = 5, Name = "Name_1", Status = false}
          };
 
       RadGrid1.DataSource = data1;
 
   }

Note : i have set below property in above grid.
EnableLinqExpressions="false"
CaseSensitive="false"

Thanks,
Jayesh Goyani
0
Chris
Top achievements
Rank 1
answered on 12 Aug 2013, 01:02 PM
The changed didn't let me filter by *.  However enabling linq expressions and including the GroupingSettings appears to have gotten everything to work the way I want. Hopefully having enableLinqExpresssions on does not break anything.

Thanks,
Chris
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Chris
Top achievements
Rank 1
Share this question
or