Hi,
This is mahali. I am using radgrid for my application.
In that radgrid i have filter options. While i enter some text in filter textbox with semicolon for search, it showing script error 'Index was out of range'.
Please give any suggestion to avoid these kind of error.
Thanks in advance.
Regards
Mahali.
13 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 22 Sep 2009, 05:29 AM
Hi Mahali,
One suggestion would be preventing the entry of : in filter textbox. Have a look at the following code which shows how to accomplish this.
CS:
JavaScript:
Thanks,
Princy
One suggestion would be preventing the entry of : in filter textbox. Have a look at the following code which shows how to accomplish this.
CS:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridFilteringItem) |
{ |
GridFilteringItem fItem = (GridFilteringItem)e.Item; |
foreach (GridColumn col in RadGrid1.MasterTableView.Columns) |
{ |
(fItem[col.UniqueName].Controls[0] as TextBox).Attributes.Add("onkeyup", "CheckChar(this, event)"); |
} |
} |
} |
JavaScript:
<script type="text/javascript"> |
function CheckChar(text,e) |
{ |
var regx, flg; |
regx = /[:]/ |
flg = regx.test(text.value); |
if (flg) |
{ |
var val=text.value; |
val=val.substr(0,(val.length)-1) |
text.value=val; |
} |
} |
</script> |
Thanks,
Princy
0

utchi
Top achievements
Rank 1
answered on 22 Sep 2009, 06:59 AM
Hi Princy,
Thanks for your coding snippet.
But i have text with semicolon in my records. I need to search with semicolons also.
So Could you please tell me some other suggestions to avoid this error and get output.
Thanks in advance.
regards,
mahali
Thanks for your coding snippet.
But i have text with semicolon in my records. I need to search with semicolons also.
So Could you please tell me some other suggestions to avoid this error and get output.
Thanks in advance.
regards,
mahali
0
Accepted
Hello Utchi,
I'm afraid that RadGrid do not support filtering using these characters. To be more specific, we consider " LIKE ", " AND ", " OR ", "\"", ">", "<", "<>", " NULL ", " IS " and '';" as unsupported.
I hope this helps.
Regards,
Pavlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I'm afraid that RadGrid do not support filtering using these characters. To be more specific, we consider " LIKE ", " AND ", " OR ", "\"", ">", "<", "<>", " NULL ", " IS " and '';" as unsupported.
I hope this helps.
Regards,
Pavlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0

utchi
Top achievements
Rank 1
answered on 22 Sep 2009, 12:27 PM
Hi Pavlina
Its ok Pavlina. You dont afraid. I will try to validate my records without that characters.
And thanks for coding snippets and suggestions.
Regards,
mahali
0

Mark Breen
Top achievements
Rank 1
answered on 28 Mar 2010, 11:18 AM
Hello Mahali,
It is nice to see your polite reply.
I am also just normal user of Telerik products, but I was happy to see you reply to Princy,
nice to meet you
Mark
0

utchi
Top achievements
Rank 1
answered on 29 Mar 2010, 12:29 PM
Thanks for your comment... Mark
Keep in touch.
Have a smiley days.
Regards,
Mahali
Keep in touch.
Have a smiley days.
Regards,
Mahali
0

Yogesh Vardhmane
Top achievements
Rank 1
answered on 02 Aug 2010, 12:00 PM
Hi ,
Have you solved this Issue. I am not able search records when i search with "%" i.e. Percentage character.
Thanks & Regards,
Yogesh
Have you solved this Issue. I am not able search records when i search with "%" i.e. Percentage character.
Thanks & Regards,
Yogesh
0

Murugesan Sivathanu
Top achievements
Rank 1
answered on 07 Dec 2011, 03:08 PM
Hi,
I am also having the same issue when I put semicolon in the filter text box, getting java script error. Is telerik team fixed the issue?
Thanks
I am also having the same issue when I put semicolon in the filter text box, getting java script error. Is telerik team fixed the issue?
Thanks
0
Hi Murugesan Sivathanu,
The reason for receiving an error is because the semicolon character is internally used to delimit a list of values in a single string. Therefore semicolon should not be allowed in your filter text.
However, you can follow the approach suggested by Shinu on this forum thread.
Regards,
Pavlina
the Telerik team
The reason for receiving an error is because the semicolon character is internally used to delimit a list of values in a single string. Therefore semicolon should not be allowed in your filter text.
However, you can follow the approach suggested by Shinu on this forum thread.
Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Elaine
Top achievements
Rank 1
answered on 29 Feb 2012, 01:30 AM
I'm also having trouble when I want to search for records that does not contain * in the field. (We have a field that contains "ABC*S" as a value and I want to exclude the records for "ABC*S" and not treat * as a wildcard. Is there a way to escape the * character in the keyup event?
The filter is working fine if I turn "EnableLinqExpressions" to true, but we don't want to turn it to true because we need to pass the filter expression into SQL in another stored proc further down the code without the Linq expressions.
The filter is working fine if I turn "EnableLinqExpressions" to true, but we don't want to turn it to true because we need to pass the filter expression into SQL in another stored proc further down the code without the Linq expressions.
0
Hi Elaine,
Can you please verify that you have tried the solution presented in the forum thread linked in the previous post and it is not working for you?
Greetings,
Pavlina
the Telerik team
Can you please verify that you have tried the solution presented in the forum thread linked in the previous post and it is not working for you?
Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Elaine
Top achievements
Rank 1
answered on 05 Mar 2012, 02:58 AM
I've tried the code and it's treating the * as a wildcard. I want to use the * as literal, so would need to know how I can escape the * character so that the filter does not use * as a wildcard. See the attached picture. We have data that is "3OB*079" in the data and if I use the "Does not contain" filter, it does not remove those records.
0
Hello,
You can examine the following link and see if it helps to achieve your goal:
http://answers.yahoo.com/question/index?qid=20090501075704AAhMpiQ
Greetings,
Pavlina
the Telerik team
You can examine the following link and see if it helps to achieve your goal:
http://answers.yahoo.com/question/index?qid=20090501075704AAhMpiQ
Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.