"AddNew not called" exception on Custom cell type

Hi there

I have implemented the DateTimePickerCell Custom cell type for my GridGroupingControl (C:\Program Files\Syncfusion\Essential Studio\5.1.0.51\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"
Source="Syncfusion.Grouping.Base"
StackTrace:
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
Grid.Focus()
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?




2 Replies

AD Administrator Syncfusion Team December 11, 2007 10:30 AM UTC

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
CurrentCell.NotifyChanged()
End If
End Sub




JM John McLean December 11, 2007 09:09 PM UTC

Thanks Clay


Loader.
Up arrow icon