Hi Alex,
Thanks for your interest in Syncfusion products.
DataBoundGrid(GDBG) is a bounded grid which just displays the content from the datasource. So, if you wish to add or remove rows in gdbg, then you should actually add/remove rows from the binded datasource, so the grid reflects the same.
To delete any arbitary row, simply use the below code:
this.gridDataBoundGrid1.EnableRemove = true;
this.grid.DeleteRecordsAtRowIndex(rowindex, rowindex);
The recommended way is to use the Binder.RemoverRecords method to delete rows.
DataTable table = (DataTable) gridDataBoundGrid1.DataSource;
int curRowIndex = gridDataBoundGrid1.CurrentCell.RowIndex;
if (gridDataBoundGrid1.Model.RowCount > 1 && curRowIndex > 0 && gridDataBoundGrid1.Model.RowCount > curRowIndex )
{
int recNumber = this.gridDataBoundGrid1.Binder.RowIndexToPositioncurRowIndex);
this.gridDataBoundGrid1.Binder.RemoveRecords(recNumber, recNumber);
}
If you are having hierarchical relationship in grid, then refer the below forum thread to delete rows in hierarchical grid.
http://www.syncfusion.com/support/forums/message.aspx?MessageID=59847 To do any validation stuff on cell, the best event to handle is CurrentCellValidating event of grid. In this event you can get the Text or value that is entered from grid.CurrentCell.Renderer.ControlText and valiadte it. Please check the kb article below on validation.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340 If you like to do any key based validations, then you may go for CurrentCellKeyPress/CurrentCellValidateString events.
Please let me know if you need any further assistance.
Regards,
Subhasheela R