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

Current cell value format

Hi How to change Current cell value of from one format to Other for example; if i got 12,345,432 in a current cell, then i want to change the value to 12345432 for current cell when the user double clicks on the cell(Current cell in editing mode). GridCurrentCell currentCell = this.dgdJobStatus.CurrentCell; decimal Value = (decimal)grid[currentCell.RowIndex, currentCell.ColIndex].CellValue ; currentCell.Renderer.ControlValue = Value.ToString(); with this code I am getting the desired value, but when i click on any cell for the first time the display of the value for the cell will be 12345432.00 which is not what i want. its happening for the first double click only. i had the above code in the CellDoubleClick event. -----seash

2 Replies

AK Anil Kumar M August 23, 2004 06:53 AM UTC

Sorry the code is like this GridCurrentCell currentCell = this.dgdJobStatus.CurrentCell; decimal Value = (decimal )this.dgdJobStatus[currentCell.RowIndex, currentCell.ColIndex].CellValue ; currentCell.Renderer.Control.Text = Value.ToString();


AD Administrator Syncfusion Team August 23, 2004 08:16 AM UTC

The CellDoubleClick is only raised when the clicked cell is not actively being edited. To catch a double click on a cell that is actvely being edited, you can use teh CurrentCellControlDoubleClick event. If you want to add commas back to your displayed value, then you can try using CurrentCellValidating. In that event, if grid.CurrentCell.Rebderer.ControlText does not contain commas, you can try setting grid.CurrentCell.Renderer.Control.Text to a string that does. But exactly how all this works, depends upon what properties you have set for style.CellValueType an dstyle.Format for this cell. If CellValueType is typeof decimal or double, then setting the Format propert to show commas should just make this work without needing to handle an event. (But I am not sure waht effect it will have on your double click code.)

Loader.
Live Chat Icon For mobile
Up arrow icon