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.
Unfortunately, activation email could not send to your email. Please try again.

Current cell value format

Thread ID:





18018 Aug 23,2004 02:50 AM Aug 23,2004 04:16 AM Windows Forms 2
Tags: GridControl
Anil Kumar M
Asked On August 23, 2004 02:50 AM

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

Anil Kumar M
Replied On August 23, 2004 02:53 AM

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();

Administrator [Syncfusion]
Replied On August 23, 2004 04:16 AM

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.)


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.