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.

"AddNew not called" exception on Custom cell type

Thread ID:





70407 Dec 10,2007 06:54 PM Dec 11,2007 04:09 PM Windows Forms 2
Tags: GridControl
John McLean
Asked On December 10, 2007 06:54 PM

Hi there

I have implemented the DateTimePickerCell Custom cell type for my GridGroupingControl (C:\Program Files\Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\2.0\CustomCellTypes\DateTimePickerCells\sample.htm). Whenever I change the value, I get the following exception:

System.InvalidOperationException was unhandled by user code
Message="AddNew not called"
at Syncfusion.Grouping.AddNewRecord.SetValue(FieldDescriptor fieldDescriptor, Object value)
at Syncfusion.Windows.Forms.Grid.Grouping.GridAddNewRecord.Syncfusion.Windows.Forms.Grid.Grouping.IGridTableCellStyleChanged.RaiseTableCellStyleChanged(GridTableCellStyleInfoEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoIdentity.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.SetValue(StyleInfoProperty sip, Object value)
at Syncfusion.Windows.Forms.Grid.GridStyleInfo.set_CellValue(Object value)
at Transpower.SAD.CommonControls.DateTimeCellRenderer.OnSaveChanges() in C:\SourceCode\MS\SAD\CommonControls\GridLogic\DatePickerCell.vb:line 78
at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown)

The exception occurs in this routine:

Protected Overrides Function OnSaveChanges() As Boolean
If CurrentCell.IsModified Then
Dim style As GridStyleInfo = Grid.Model(Me.RowIndex, Me.ColIndex)
style.CellValue = Me.dateTimePicker.Value

Return True
End If
Return False
End Function

Line: style.CellValue = Me.dateTimePicker.Value

What am I missing here?

Administrator [Syncfusion]
Replied On December 11, 2007 05:30 AM

In the renderer code, try changing the datePicker_ValueChange handler to

Private Sub datePicker_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
If CurrentCell.NotifyChanging() Then
CurrentCell.IsModified = True
End If
End Sub

John McLean
Replied On December 11, 2007 04:09 PM

Thanks Clay


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.