We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Row\Cell validation in GDBG

In GDBG, 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? Thanks, GilK

1 Reply

AD Administrator Syncfusion Team November 21, 2004 04:41 PM UTC

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); this.gridDataBoundGrid1.CurrentCell.EndEdit(); this.gridDataBoundGrid1.Binder.RemoveRecords(pos, pos); 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.

Loader.
Live Chat Icon For mobile
Up arrow icon