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
close icon

Change cellType dataBoundGrid

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.

2 Replies

AD Administrator Syncfusion Team September 17, 2003 08:25 AM UTC

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.


IO ionutB September 18, 2003 04:58 AM UTC

Thanks for the quick response.

Loader.
Live Chat Icon For mobile
Up arrow icon