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

i stock in validating (radGridView)

1 Answer 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nima
Top achievements
Rank 1
Nima asked on 28 Mar 2012, 08:26 AM
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

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Apr 2012, 08:49 AM
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;
        return;
    }
     
    //validation logic here
}

I hope this helps.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Nima
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or