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.
Syncfusion Feedback

Formatting exception

Thread ID:

Created:

Updated:

Platform:

Replies:

40593 Feb 7,2006 08:37 PM UTC Feb 8,2006 09:33 AM UTC Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 7, 2006 08:37 PM UTC

we recently migrated to 4.0 and what is happening is in GDBG when user moves to cell whose underlying celltype is currency and press the del key and then try to tab out.. we get the following exception. I have attached the source code, and to reproduce this problem scroll to qty column and press del key and then try to tab out. u shud see the below exception. System.ArgumentException: System.FormatException: Input string was not in a correct format. at System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info) at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider) at System.Convert.ToDouble(String value, IFormatProvider provider) at System.String.System.IConvertible.ToDouble(IFormatProvider provider) at System.Convert.ToDouble(Object value) at System.Data.Common.DoubleStorage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn''t store <> in Qty Column. Expected type is Double. at System.Data.DataColumn.set_Item(Int32 record, Object value) at System.Data.DataRow.set_Item(DataColumn column, Object value) at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value) at System.Data.DataColumnPropertyDescriptor.SetValue(Object component, Object value) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.SaveCellInfo(GridSaveCellInfoEventArgs e) catched at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.SaveCellInfo(GridSaveCellInfoEventArgs e) in :line 0 System.ArgumentException: System.FormatException: Input string was not in a correct format. at System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info) at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider) at System.Convert.ToDouble(String value, IFormatProvider provider) at System.String.System.IConvertible.ToDouble(IFormatProvider provider) at System.Convert.ToDouble(Object value) at System.Data.Common.DoubleStorage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn''t store <> in Qty Column. Expected type is Double. at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.SaveCellInfo(GridSaveCellInfoEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.Syncfusion.Windows.Forms.Grid.IGridModelDataProvider.SaveCellInfo(GridSaveCellInfoEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly) at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType) at Syncfusion.Windows.Forms.Grid.GridModel.ChangeCells(GridRangeInfo range, GridStyleInfo[] cellsInfo, StyleModifyType modifyType) at Syncfusion.Windows.Forms.Grid.GridModel.Syncfusion.Windows.Forms.Grid.IGridVolatileDataContainer.ChangeCell(Int32 rowIndex, Int32 colIndex, GridStyleInfo style) at Syncfusion.Windows.Forms.Grid.GridVolatileData.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfo value) at Syncfusion.Windows.Forms.Grid.GridStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.EndUpdate() at Syncfusion.Windows.Forms.Grid.GridCellModelBase.ApplyText(GridStyleInfo style, String text) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyText(String text) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.set_Text(String value) at Syncfusion.Windows.Forms.Grid.GridCurrencyTextBoxCellRenderer.OnSaveChanges() at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseSaveChanges() at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) in :line 0

WinApp100.zip

Administrator [Syncfusion]
Replied On February 8, 2006 09:33 AM UTC

Hi Yogi, You can try setting the CellValueType of the currency column to Double and handle the CurrentCellValidating Event of the grid. The code below will help you. this.gridBoundColumn2.StyleInfo.CellValueType = typeof(System.Double); //CurrentCellValidating Event private void gridDataBoundGrid1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; if(cc.ColIndex == this.gridDataBoundGrid1.Binder.NameToColIndex("Qty")) { if(cc.Renderer.ControlText == "") { cc.Renderer.ControlValue = DBNull.Value; } } } Please refer to the Sample modified.Sample Thanks, Rajagopal

CONFIRMATION

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.

Warning Icon 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.Close Icon

;