Formatting and Type problem

I am using the Essential Studio v3.2.1.0 Grid in unbound mode. As I load data into the grid I am setting cell specific formatting and Type requirements as follows: Dim CellInfo As GridStyleInfo = Me.gridData.Item(RowIndex, ColIndex) CellInfo.Format = "#0.00%" CellInfo.CellValueType = GetType(Single) CellInfo.CellValue = .181 The grid properly displays "18.10%", the CellValue is .181, and CellValueType is Single. When the user edits the value and changes it to for example "18.40%" I receive the following exception: A first chance exception of type ''System.Exception'' occurred in system.dll Additional information: 18.4% is not a valid value for Single. If I do not set the CellValueType property to Single the user can successfully edit the cell, but the CellValueType changes from Single to String and the CellValue is the string "18.40%" not .184. Tracing the events I was able to determine this Type conversion occurs between the CurrentCellChanged event (the underlying Type was still Single during this event) and the CurrentCellEditingComplete (the underlying Type is a String during this event). The Type conversion to a String causes problems when I save data back to my objects and/or the database. The requirement is to display "18.4%" but store and persist to the database .184. Thank you for any suggestions. Ron Pisarz, Jr.

1 Reply

AD Administrator Syncfusion Team November 17, 2005 11:22 PM UTC

One way you can handle this is to strip out the % in CurrentCellValidating (if it is there). Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GC_PC_6b91eaf5.zip

Loader.
Up arrow icon