DK
Dani Knopf
August 24, 2010 07:28 AM UTC
Hi
First of all, thank you for your reply.
I already know that I have to sort the underlying datasource (in my case a List filled with entity objects). This is not causing any problems.
I use the DragEnter event to get the index of the row to move and
the OnMouseUp event to actually move the selected row. However, as I explained in a previous post, the OnMouseUp event is never triggered, because an exception is shown ("Object of type 'System.DBNull' cannot be converted to type 'System.Guid')
The flow of events (as far as I have seen) is as follows:
1. I use the mouse to starte dragging a row vie row header!
2. DragEnter is called!
3. OnCurrentCellErrorMessage event is called (why?? the underlying object is valid)
4. Strangely, in my case, the value of the property in the bound object is set to null: The name property is suddenly empty.
-----------Below the stacktrace (caught in OnCurrentCellErrorMessage:
> PresentationLayer.exe!Buchi.KjeLink.PresentationLayer.ViewControls.Grid.CustomGrid.OnCurrentCellErrorMessage(Syncfusion.Windows.Forms.Grid.GridCurrentCellErrorMessageEventArgs e = {Syncfusion.Windows.Forms.Grid.GridCurrentCellErrorMessageEventArgs}) Line 99 C#
Syncfusion.Grid.Windows.dll!Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellErrorMessage(Syncfusion.Windows.Forms.Grid.GridCurrentCellErrorMessageEventArgs e = {Syncfusion.Windows.Forms.Grid.GridCurrentCellErrorMessageEventArgs}) + 0x3d bytes
Syncfusion.Grid.Windows.dll!Syncfusion.Windows.Forms.Grid.GridCurrentCell.DisplayWarningText(string message) + 0xc1 bytes
Syncfusion.Grid.Windows.dll!Syncfusion.Windows.Forms.Grid.GridControlBase.OnMouseDown(System.Windows.Forms.MouseEventArgs e) + 0x267 bytes
Syncfusion.Grid.Windows.dll!Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnMouseDown(System.Windows.Forms.MouseEventArgs e) + 0x6 bytes
------------- The debug output: ------------
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.ObjectStorage.CompareValueTo(Int32 recordNo1, Object value)
at System.Data.Index.FindNodeByKey(Object originalKey)
at System.Data.DataView.System.ComponentModel.IBindingList.Find(PropertyDescriptor property, Object key)
at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key)
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
catched at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.FindKey(IList thisList, PropertyDescriptor property, Object key) in :line 0
System.ArgumentException: Object of type 'System.DBNull' cannot be converted to type 'System.Guid'.
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
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.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.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridComboBoxCellModel.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyFormattedText(String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridModel.ClearCells(GridRangeInfoList rangeList, Boolean clearStyle)
catched at Syncfusion.Windows.Forms.Grid.GridModel.ClearCells(GridRangeInfoList rangeList, Boolean clearStyle) in :line 0
System.ArgumentException: Object of type 'System.DBNull' cannot be converted to type 'System.Guid'.
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
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.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.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridComboBoxCellModel.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyFormattedText(String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridModel.ClearCells(GridRangeInfoList rangeList, Boolean clearStyle)
System.ArgumentException: Object of type 'System.DBNull' cannot be converted to type 'System.Guid'.
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
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.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.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridComboBoxCellModel.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyFormattedText(String text, Int32 textInfo)
at Syncfusion.Windows.Forms.Grid.GridModel.ClearCells(GridRangeInfoList rangeList, Boolean clearStyle)
at Syncfusion.Windows.Forms.Grid.GridDataBoundGridModel.OnClearingCells(GridClearingCellsEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridModel.ClearCells(GridRangeInfoList rangeList, Boolean clearStyle)
at Syncfusion.Windows.Forms.Grid.GridOleDataSourceMouseController.DndStartDragDrop(Int32 rowIndex, Int32 colIndex)
at Syncfusion.Windows.Forms.Grid.GridOleDataSourceMouseController.MouseDown(MouseEventArgs e)
at Syncfusion.Windows.Forms.MouseControllerDispatcher.ProcessMouseDown(MouseEventArgs e)
at Syncfusion.Windows.Forms.ScrollControllMouseControllerDispatcher.ScrollControlBeforeMouseDown(Object sender, CancelMouseEventArgs e)
at Syncfusion.Windows.Forms.ScrollControl.OnScrollControlMouseDown(CancelMouseEventArgs e)
at Syncfusion.Windows.Forms.Grid.GridControlBase.OnScrollControlMouseDown(CancelMouseEventArgs e)
at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d)
catched at Syncfusion.Windows.Forms.Grid.GridModel.ClearCells(GridRangeInfoList rangeList, Boolean clearStyle) in :line 0
catched at Syncfusion.Windows.Forms.ScrollControl.RaiseCancelMouseEvent(MouseEventArgs e, CancelMouseDelegate d) in :line 0
The thread '' (0xd0c) has exited with code 0 (0x0).