I'm using a DataBoundGrid which uses a collection derived from CollectionBase, IBindingList, ITypedList, ITransaction as DataSource.
I need to change the CellType of the current cell from TextBox to Currency when I click the cell (or RowEnter) and after the string in the cell is modified(RowLeave), change again to TextBox.
I need these behavior because the grid doesn't validates the data if the cellType isn't TextBox.
ADAdministrator Syncfusion Team September 17, 2003 03:25 AM
Exactly what do you mean by "because the grid doesn't validates the data if the cellType isn't TextBox"?
The CurrentCellValidating event should be hit no matter what the cell type is.
Swapping out a cell control while the cell is the active cell is problematic. If it is not the active cell, you could subscribe to the Model.QueryCellInfo event and set e.Style.CellType depending upon whether e.RowIndex was the grid.CurrentCell.RowIndex and if e.ColIndex pointed to the column.
Here is a forum thread that has a little sample that derives a cell control that only uses a currency control if the cell is actively being edited. Otherwise, it uses a static cell. Maybe something like this would work for you.