This is a migrated thread and some comments may be shown as answers.

Miltiple aims hierarchical grid issue

3 Answers 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Karthik
Top achievements
Rank 1
Karthik asked on 20 Jun 2011, 03:34 PM

Current Version we are using is Q2 2010 SP1 Version 2010.2.10.713. We are facing the following issue:

In grid CellEndEdit, we perform some operation on the current item of the binding source and then trying to reset it. When we use ResetBindings(), it throws the null reference (PFA) and when we use ResetCurrentItem() or ResetItem(), it throws index out of range exception (but the item which we are trying to reset is present in the binding source).

1. If we use ResetBindings() on a text box inside the child grid:
An unhandled exception occurred, and the application is terminating. For more information, see your Application event log.
 - Exception Details -
Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.GridViewEditManager.EndEdit()
   at Telerik.WinControls.UI.GridRowBehavior.ProcessEnterKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.GridRowBehavior.ProcessKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridBehavior.ProcessKey(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridBehavior.ProcessKeyDown(KeyEventArgs keys)
   at Telerik.WinControls.UI.BaseGridEditor.OnKeyDown(KeyEventArgs keyEventArgs)
   at Telerik.WinControls.UI.GridSpinEditor.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.GridSpinEditor.spinElement_KeyDown(Object sender, KeyEventArgs e)
   at Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadSpinElement.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadSpinElement.textItem_KeyDown(Object sender, KeyEventArgs e)
   at Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_KeyDown(Object sender, KeyEventArgs e)
   at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
   at System.Windows.Forms.TextBox.WndProc(Message& m)
   at Telerik.WinControls.UI.HostedTextBoxBase.WndProc(Message& message)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

2. If we use ResetCurrentItem() or ResetItem() instead on the same text box field in the child grid:
 

An unhandled exception occurred, and the application is terminating. For more information, see your Application event log.

- Exception Details -

Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)

at System.ThrowHelper.ThrowArgumentOutOfRangeException()

at System.Collections.Generic.List`1.get_Item(Int32 index)

at Telerik.WinControls.Data.RadCollectionView`1.get_Item(Int32 index)

at Telerik.WinControls.Data.RadCollectionView`1.Find(Int32 itemIndex, Object dataBoundItem)

at Telerik.WinControls.Data.RadDataView`1.Find(Int32 itemIndex, Object dataBoundItem)

at Telerik.WinControls.Data.RadListSource`1.ChangeItem(Int32 index, TDataItem item)

at Telerik.WinControls.Data.RadListSource`1.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)

at System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)

at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)

at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)

at System.Windows.Forms.BindingSource.ResetCurrentItem()

at Lbg.PlanNet.Client.BusinessModules.PersonalAdviceProcess.UI.AllocateAssetsToMultipleAimsView.allocatedValueElement_ValueChanged(Object sender, EventArgs e) in c:\Sasi\CurrentLatest\Client\SmartClient\BusinessModules\BusinessModules.PersonalAdviceProcess.UI\Views\AllocateAssetsToMultipleAimsView\AllocateAssetsToMultipleAimsView.cs:line 439

at System.EventHandler.Invoke(Object sender, EventArgs e)

at Telerik.WinControls.UI.RadSpinElement.OnValueChanged(EventArgs e)

at Telerik.WinControls.UI.GridSpinEditorElement.SetSpinValue(Decimal value, Boolean fromValue)

at Telerik.WinControls.UI.RadSpinElement.EndTextEdit()

at Telerik.WinControls.UI.RadSpinElement.Validate()

at Telerik.WinControls.UI.GridSpinEditor.OnKeyDown(KeyEventArgs e)

at Telerik.WinControls.UI.GridSpinEditor.spinElement_KeyDown(Object sender, KeyEventArgs e)

at Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)

at Telerik.WinControls.UI.RadSpinElement.OnKeyDown(KeyEventArgs e)

at Telerik.WinControls.UI.RadSpinElement.textItem_KeyDown(Object sender, KeyEventArgs e)

at Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)

at Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_KeyDown(Object sender, KeyEventArgs e)

at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)

at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)

at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)

at System.Windows.Forms.Control.WmKeyChar(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.TextBoxBase.WndProc(Message& m)

at System.Windows.Forms.TextBox.WndProc(Message& m)

at Telerik.WinControls.UI.HostedTextBoxBase.WndProc(Message& message)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.



Kindly advise if there is any way to avoid this error?.

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 22 Jun 2011, 01:35 PM
Hello Karthik,

You can find the answer to your question in your previous support ticket. Please avoid asking the same question twice as this may slow down our response.

If you have any other questions, we will be glad to help.

Regards,
Jack
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
Mani
Top achievements
Rank 1
answered on 06 Dec 2011, 10:23 PM
Hi
We are facing the same issue reported here. Could you please share the fix? We are using the same telerik version and getting same exception.
0
Jack
Telerik team
answered on 08 Dec 2011, 02:20 PM
Hi V,

As requested I am posting here the solution for this issue:

Calling the ResetBindings method will reset all logical states and will recreate all visual elements in RadGridView. We do not recommend calling this method when handling the CellEndEdit event. Please, could you describe with more detail the changes that you do in the data source. Maybe we could find a better option.

If you still want to call this method, you have to suspend all updates in RadGridView. Here is a sample:

this.radGridView1.BeginUpdate();
this.customersBindingSource.ResetBindings(false);
this.radGridView1.EndUpdate(false);
this.radGridView1.TableElement.VScrollBar.Value = 1;
this.radGridView1.TableElement.VScrollBar.Value = 0;

I hope this will work in your scenario. If you have further questions, do not hesitate to contact me.
 
Best wishes,
Jack
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Tags
GridView
Asked by
Karthik
Top achievements
Rank 1
Answers by
Jack
Telerik team
Mani
Top achievements
Rank 1
Share this question
or