1.How can I validate new row before I leave it?
Is there a way on "RowLeave" event to ask the grid if the row is valid?
2.Is there a way to remove a new record programmaticly from a grid if "EnableRemove=false"?
I don''t want to allow users to remove record from the grid, but if the row is not valid, I would like to remove it!
3.If cell validate is failed, is there a way to get the error message progrmmaticly, and override the default behaviour(A pop up message is displayed) of the grid?
ADAdministrator Syncfusion Team November 21, 2004 11:41 AM
1) As far as whether cell entries are the proper type (like trying to type ABC into a double cell), the grid''s default behavior is to do this validation on a cell by cell basis for you. So, in RowLeave, the row is always valid (except possibly for the last cell modified - but that will be validated as part of the RowLeave.)
Now if you want to do special validation (something other than the default system type checks), then you can do that is RowLeave. But the grid would not know whether the row was valid of not, you would have to add whatever code you needed to test whethee the row is valid.
2) To delete a record, you can try:
int pos = this.gridDataBoundGrid1.Binder.RowIndexToPosition(this.gridDataBoundGrid1.CurrentCell.RowIndex);
3) You can handle the grid.ValidateFailed event. In the handler, you can set grid.CurrentCell.ErrorMessage to your string to see your message, or you can set it to the empty string to see no message from teh grid.