Thanks for the reply, Muhammad. Yes, you are correct. The RowValidating event is only firing once, not for every keypress as I thought. I looked into using the CellValueChanged event but it is not possible to cancel in that event.
I created a function to check whether a record exists and tried adding that check to the RowValidating event as this is where I need to do the check in order to have the ability to cancel if needed. However, the check returns true for all existing records in the grid. I need a way to distinguish between existing records and a new row that the user is adding so that I can do this check for that row only.
Thanks.
Main Topics
Browse All Topics





by: MuhammadKashifPosted on 2008-09-22 at 22:08:03ID: 22546574
Hi adlink_la,
RowValidating is not fired at every keypress. It is fired when a row is committed.
Following events displays error when you try to delete row in these events.
CellEnter
CellLeave
CellValidating
CellValidated
RowEnter
RowLeave
RowValidating
RowValidated
So you should use CellValueChanged event and also you can have you validation in this event.