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

CellEndEdit - delete row

2 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mercell
Top achievements
Rank 2
Mercell asked on 05 Dec 2011, 09:45 AM
Hi,

If I try to delete a row in the CellEndEdit event I get an "Object reference not set to an instance of an object." exception.

I tried using row.Delete() and removing the item from the underlying datasource but both generates the same error.

Using: 2010.3.10.1215

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.GridViewEditManager.EndEditCore(Boolean validate, Boolean cancel)
   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.RadTextBoxEditor.OnKeyDown(KeyEventArgs e)
   at Telerik.WinControls.UI.RadTextBoxEditor.TextBoxItem_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.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)

How do I solve this?

Regards,
Brian

2 Answers, 1 is accepted

Sort by
0
Srinivas
Top achievements
Rank 1
answered on 07 Dec 2011, 11:04 AM
i am also searching for same solution
0
Jack
Telerik team
answered on 08 Dec 2011, 10:33 AM
Hi guys,

I tested the described scenario using our latest release - Q3 2011. I have not observed issues when executing the following code in CellEndEdit event:
void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
{
    e.Row.Delete();
}

Could you please open new support tickets and us your applications? This will allow us to investigate this issue further. Thank you for your cooperation.

I am looking forward to your reply.
 
All the best,
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
Mercell
Top achievements
Rank 2
Answers by
Srinivas
Top achievements
Rank 1
Jack
Telerik team
Share this question
or