hi
Could some one tell me how to block the filtering of special charetors ina grid
In my application, the grid has a filter colomn when i type special charectore in the filter and select "Equal to" i am geting the following error.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Requested value '[]:"' was not found.
could you tell me how to handle this
Could some one tell me how to block the filtering of special charetors ina grid
In my application, the grid has a filter colomn when i type special charectore in the filter and select "Equal to" i am geting the following error.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Requested value '[]:"' was not found.
could you tell me how to handle this
4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 14 Jan 2010, 07:22 AM
Hello Sharon
Check out the following code to avoid filtering using special characters:
C#:
JavaScript:
Hope this helps..
Princy.
Check out the following code to avoid filtering using special characters:
C#:
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridFilteringItem) |
| { |
| GridFilteringItem filterItem = (GridFilteringItem)e.Item; |
| foreach (GridColumn col in RadGrid1.MasterTableView.Columns) |
| { |
| (filterItem[col.UniqueName].Controls[0] as TextBox).Attributes.Add("onkeyup", "CharacterCheck(this, event)"); |
| } |
| } |
| } |
JavaScript:
| <script type="text/javascript"> |
| function CharacterCheck(text,e) |
| { |
| var regx, flg; |
| regx = /[^0-9a-zA-Z'' ]/ |
| flg = regx.test(text.value); |
| if (flg) |
| { |
| var val=text.value; |
| val=val.substr(0,(val.length)-1) |
| text.value=val; |
| } |
| } |
| </script> |
Hope this helps..
Princy.
0
Sharon
Top achievements
Rank 2
answered on 14 Jan 2010, 08:56 AM
Hi princy
its still not working
Actually i am using filtering only for two fields in the grid so i have made some changes to the code u send me but thats also not working
the change i made are
i have not made any changes to the JScript you send me
do u have any other suggestion
its still not working
Actually i am using filtering only for two fields in the grid so i have made some changes to the code u send me but thats also not working
the change i made are
| protected void gvDigProperty_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridFilteringItem) |
| { |
| GridFilteringItem filterItem = (GridFilteringItem)e.Item; |
| foreach (GridColumn col in gvDigProperty.MasterTableView.Columns) |
| { |
| (filterItem["Propertytype"].Controls[0] as TextBox).Attributes.Add("onkeyup", "CharacterCheck(this, event)"); |
| (filterItem["PRO_AMT_WORTH"].Controls[0] as TextBox).Attributes.Add("onkeyup", "CharacterCheck(this, event)"); |
| } |
| } |
| } |
| function CharacterCheck(text, e) { |
| var regx, flg; |
| regx = /[^0-9a-zA-Z'' ]/ |
| flg = regx.test(text.value); |
| if (flg) { |
| var val = text.value; |
| val = val.substr(0, (val.length) - 1) |
| text.value = val; |
| } |
| } |
do u have any other suggestion
0
Hello Sharon,
I have followed your scenario and prepared a sample project for you using the code Princy suggested.
I hope you will find it useful.
Kind regards,
Mira
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 have followed your scenario and prepared a sample project for you using the code Princy suggested.
I hope you will find it useful.
Kind regards,
Mira
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
Sharon
Top achievements
Rank 2
answered on 19 Jan 2010, 09:10 AM
hi Mira
thank you for your reply
regards
Sharon
thank you for your reply
regards
Sharon