Cell Validation in GridView

3 posts, 1 answers
  1. shortie
    shortie avatar
    23 posts
    Member since:
    Jul 2008

    Posted 28 Jul 2009 Link to this post

    Hello,

    We used to use Validating event to do cell validation in the versions before Q2. This event will get fired when a user types in a cell and then moves the input focus to another cell in the same row, to another cell in different rows or to other controls in the form.

    In Q2, it seems that this event won't get fired as the previous versions do. How can we achieve cell validation that our customers ask us to do in Q2?

    Thanks in advance

    BR/shortie

  2. Answer
    Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 29 Jul 2009 Link to this post

    Hi ChunChang,

    Thank you for contacting us.

    The Validating event is triggered whenever the RadGridView loses focus. In your case I believe that the most convenient event to handle is CellValidating. It fires each time a cell loses focus. Please, note that the cell should not necessarily have been in edit mode in order to fire the event. This implies that CellValidating is triggered when the user changes the selected cell, even if the RadGridView is ReadOnly.

    However, if you would like to handle the cases only when the value of the cell is being changed, you can use the following approach:

    private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e) 
        if (this.radGridView1.IsInEditMode) 
        { 
            //Your code goes in here 
        } 

    I hope this is helpful. If you encounter further issues, please, contact me back.

    Best wishes,
    Boryana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. shortie
    shortie avatar
    23 posts
    Member since:
    Jul 2008

    Posted 29 Jul 2009 Link to this post

    Hi Boryana,

    Thanks for your help. The CellValidating is the event we need. Does this event exist in the earlier versions? If it did, we must use the wrong event (Validating) in former versions. Anyway, you saved our life and our customers are happy now. Thanks again.

    BR/shortie

Back to Top