Radgrid Filtering problem..

5 posts, 1 answers
  1. Lokesh
    Lokesh avatar
    89 posts
    Member since:
    Jul 2012

    Posted 08 Mar 2012 Link to this post

    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..
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Mar 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lokesh
    Lokesh avatar
    89 posts
    Member since:
    Jul 2012

    Posted 08 Mar 2012 Link to this post

    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..
  5. Answer
    jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 12 Mar 2012 Link to this post

    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!


  6. Lokesh
    Lokesh avatar
    89 posts
    Member since:
    Jul 2012

    Posted 15 Mar 2012 Link to this post

    Hi jumpstart..
    Thanks a ton for your reply..
    This is what I was looking for..

    Thanks ..
    Lok..
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017