i stock in validating (radGridView)

2 posts, 0 answers
  1. Nima
    Nima avatar
    1 posts
    Member since:
    Aug 2011

    Posted 28 Mar 2012 Link to this post

    hi dear telerik support team.

    i got a problem , i have a radGridView .
    in my gridView there is a rowValidating event.
    but there is a problem , when the user needs to delete a row, rowValidating fires!
    so if the data in the row be invalid => e.cancel = true;
    and row does not delete

    q1 2011 , win forms

    thanks , I`m waiting for your responding
  2. Stefan
    Stefan avatar
    2908 posts

    Posted 02 Apr 2012 Link to this post

    Hello Nima,

    Thank you for writing.

    What I can suggest for your scenario is to subscribe to the UserDeletingRow event which fires, when the user attempts to delete a row. In the event handler raise a flag, which will help you determine whether to execute your validation logic or not:
    bool deletingRow = false;
    void radGridView1_UserDeletingRow(object sender, GridViewRowCancelEventArgs e)
        deletingRow = true;
    void radGridView1_RowValidating(object sender, RowValidatingEventArgs e)
        if (deletingRow)
            deletingRow = false;
        //validation logic here

    I hope this helps.
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top