I have a grid view, which values can be edited by the user. I want to refresh the content of the grid, if the user changes the value of the cell. So say I have :
1, 2, 3 as the initial state. If the user changes the value 2 to 5, i want the values in the grid to show , 1,5,6. ( this is a new list that's get assigned as data source to the gridview )
My understanding is that in order to refresh the grid. One has to create a new reference of the list and reasign it to the data source.
When this is done in the CellValueChanged event, the gridview crashes, with the following error.
How does one refresh the grid view after a value has changed ?
- Thanks
Steps to get the error :
1. Create a GridView
2. Assign it for data source a list of your favorite object. Strings or what not.
3. Add a handler for the CellValueChanged.
4. On the CellValueChanged handler, asign a new list of strings of your to the grid's data source.
5. Build start. Edit a cell, and hit enter.
Error Message.
at Telerik.WinControls.UI.GridViewEditManager.EndEditCore(Boolean validate, Boolean cancel)
at Telerik.WinControls.UI.GridViewEditManager.EndEdit()
at Telerik.WinControls.UI.RadGridViewElement.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Watson.ModelingTool.Main() in C:\Development\Watson\GL.Desktop\ModelingTool\ModelingTool.cs:line 45
1, 2, 3 as the initial state. If the user changes the value 2 to 5, i want the values in the grid to show , 1,5,6. ( this is a new list that's get assigned as data source to the gridview )
My understanding is that in order to refresh the grid. One has to create a new reference of the list and reasign it to the data source.
When this is done in the CellValueChanged event, the gridview crashes, with the following error.
How does one refresh the grid view after a value has changed ?
- Thanks
Steps to get the error :
1. Create a GridView
2. Assign it for data source a list of your favorite object. Strings or what not.
3. Add a handler for the CellValueChanged.
4. On the CellValueChanged handler, asign a new list of strings of your to the grid's data source.
5. Build start. Edit a cell, and hit enter.
Error Message.
at Telerik.WinControls.UI.GridViewEditManager.EndEditCore(Boolean validate, Boolean cancel)
at Telerik.WinControls.UI.GridViewEditManager.EndEdit()
at Telerik.WinControls.UI.RadGridViewElement.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Watson.ModelingTool.Main() in C:\Development\Watson\GL.Desktop\ModelingTool\ModelingTool.cs:line 45