1)How to set focus to a cell in a data grid?
2) Is is possible to have a default value in the new row created with EnableAddNew = true. If possible can you give me the sample code to do so.
Thanks in advance.
ADAdministrator Syncfusion Team June 16, 2003 03:16 AM
1) Use grid.CurrentCell.MoveTo to set the current cell to a particular row and column. If you are trying to do this from Form-Load, also set grid.ForceCurrentCellMoveTo = true;
2) In the grid, the default values come from GridDataBoundGrid.Model.ColStyles[col].CellValue. So, in your formload, if you have the DataTable.Columns[col].DefaultValue's, you could move them into the ColStyles. Here is a little sample showing how you might do it.
But if you want to dynamically set the values without relying on the defaults in the DataTable, try handling CurrentCellMoved.