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

grid filters are not filtering capital characters

4 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 12 Mar 2014, 04:21 PM
Hi,

I have a Rad grid on one of my page with filters on top. When I try to search these strings

REMEDIATION ANDRESTORATIONSERVICES, INC
REMEDIATION AND RESTORATIONSERVICES, INC

first one is searched but not the second one. Only the difference is one extra space character in 2nd string. I spent my whole day but unable to understand either its issue with capital characters or with longer words string. 

Please advice something.

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Mar 2014, 09:19 AM
Hi Muhammad,

If you have strings like "AND", "OR"," LIKE ", ">", "<", "<>", " NULL ", " IS " in your columns they are illegal strings. Please try the following code snippet to get it filtered properly.

C#:
protected void Page_Load(object sender, EventArgs e)
{
GridFilterFunction.IllegalStrings = new string[] {" LIKE ", ">", "<", "<>", " NULL ", " IS "};      
}

Thanks,
Princy
0
Muhammad
Top achievements
Rank 1
answered on 13 Mar 2014, 04:20 PM
Hi, I have inserted your provided code in page load event and init event but nothing happens. I placed it in both events and one by one also but no success. Any other hint plz ?
0
Princy
Top achievements
Rank 2
answered on 14 Mar 2014, 03:46 AM
Hi Muhammad,

Please try the sample code snippet shown below, it filtered properly at my end.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowFilteringByColumn="true" EnableLinqExpressions="false" OnNeedDataSource="RadGrid1_NeedDataSource">
    <GroupingSettings CaseSensitive="true" />
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" />
            <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" />
            <telerik:GridBoundColumn DataField="Number" HeaderText="Number" UniqueName="Number" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    dynamic data = new[] {
new { ID = 1, Name = "Name1", Number=123},
new { ID = 2, Name = "REMEDIATION AND RESTORATIONSERVICES, INC", Number=234},
new { ID = 3, Name = "REMEDIATION ANDRESTORATIONSERVICES, INC", Number=234},
new { ID = 4, Name = "Name4", Number=456},
new { ID = 5, Name = "Name5", Number=567},
new { ID = 6, Name = "REMEDIATION AND RESTORATIONSERVICES, INC", Number=567},
new { ID = 7, Name = "Name7", Number=789},
new { ID = 8, Name = "REMEDIATION ANDRESTORATIONSERVICES, INC", Number=896},
new { ID = 9, Name = "REMEDIATION AND RESTORATIONSERVICES, INC", Number=741}
};
    RadGrid1.DataSource = data;
}
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    GridFilterFunction.IllegalStrings = new string[] { " LIKE ", " OR ", ">", "<", "<>", " NULL ", " IS " };
}

Thanks,
Princy

0
Muhammad
Top achievements
Rank 1
answered on 14 Mar 2014, 11:06 AM
Thanks Princy.

your provided solution is working perfectly. But when I tried to put this in my application it stops working. I have added your provided grid markup and code behind on the same page when I have my grid. Your grid was working but the one mine does't.

its confusing :(
Tags
Grid
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Muhammad
Top achievements
Rank 1
Share this question
or