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

Radgrid Filtering problem..

4 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lokesh
Top achievements
Rank 1
Lokesh asked on 08 Mar 2012, 11:57 AM
Hi Team,
Greetings for the day..!!

I have a rad-grid with some template columns and some bound columns..
One column holds Amount .
If user enters some garbage value like ANVDSfdsfvgds@#$%  ..  in Amount column filter, I get some run-time error.
Same thing happens when garbage value is entered in Date column.
Is it possible to overcome this? Is there any way which can prevent user from entering such garbage values ??
Can we show some message to user saying "Please enter valid ....date or amount ..."

My tester is literally harassing me on this.. 

Any help appreciated.

Thanks, 
Lok..

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Mar 2012, 12:10 PM
Hello,

You can access the filtering item as shown below and apply validation as explained in this documentation.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
  if (e.Item is GridFilteringItem)
  {
   GridFilteringItem item = (GridFilteringItem)e.Item;
  }
}

Thanks,
Princy.
0
Lokesh
Top achievements
Rank 1
answered on 08 Mar 2012, 02:35 PM
Hi Princy,
Thank you for your reply.
I think you didn't get my problem...
I want to validate text in Filter control of the grid..
Please see the attached image...
The link you have given shows how to validate controls in grid while inserting or updating record.
I want to validate the text entered in FILTER CONTROL of the grid...

I am really frustrated..
Please help me..

Thanks,
Lok..
0
Accepted
Richard
Top achievements
Rank 1
answered on 12 Mar 2012, 07:30 PM
Lokesh:

You could use the approach that is covered in the following forum post to attach an "onkeyup" event to the textbox of the filter item for each column, associating it with a JavaScript client-side function that uses regular expressions to determine if the entry is valid.

Filtering Grid on ";" Character Causes Error

The difficult part of this will be to write the regular expressions required to validate for acceptable entries.

Hope this helps!


0
Lokesh
Top achievements
Rank 1
answered on 15 Mar 2012, 02:10 PM
Hi jumpstart..
Thanks a ton for your reply..
This is what I was looking for..

Thanks ..
Lok..
Tags
Grid
Asked by
Lokesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Lokesh
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Share this question
or