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

NullReferenceException on RightClick event.

1 Answer 82 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fabian
Top achievements
Rank 1
Fabian asked on 08 Jan 2009, 05:00 PM
Hi,
we integrated GridView into a application and added a standard ContextMenu. When clicking on items in the GridView everything seems perfectly fine, but a click onto free space in the GridView results in an Exception:

Object reference not set to an instance of an object. 
 
System.NullReferenceException: Object reference not set to an instance of an object 
at 
Telerik.WinControls.UI.BaseGridBehavior.OnMOuseDownRight(MouseEventArgs e) 
at 
Telerik.WinControls.UI.BaseGridBehavior.OnMOuseDown(MouseEventArgs e) 
at 
Telerik.WinControls.UI.RadGridView.OnMOuseDownRight(MouseEventArgs e) 
at 
System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clickt) 
at System.Windows.Forms.Control.WndProc(Message& m) 
at System.Windows.Forms.ScrollableControl.WndProc(Message& m) 
at Telerik.WinControls.RadControl.WndProc(Message& m) 
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) 

We also discovered what seems to be a major problem to the GridView Designer. If you add a System.Windows.Forms.ContextMenu to the GridView using the Designer, save this state and try to re-open the Designer Visual Studio suddenly crashes..

Best wishes,
Fabian Becker
mbi GmbH

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 10 Jan 2009, 01:04 PM
Hi Fabian,

Thank you for contacting us.

Regarding the first question, please refer to the following forum thread: http://www.telerik.com/community/forums/winforms/gridview/problem-with-q3-2008-sp1-and-multiselect.aspx . The issue will be addressed in Q3 2008 SP2 scheduled for end of the current month.

As to your second issue: the type used in the designer (System.Windows.Forms.ContextMenu) leads me to the thought that you are using .NET 1.1. If this is the case, please note that we do not support .NET 1.1, but .NET 2.0, as pointed here

In addition, please note that RadGridView has ContextMenuStrip property which get instances of type ContextMeuStrip only. You cannot assign instances of type ContextMenu.

If your scenario concerns using System.Windows.Forms.ContextMenuStrip, I am not able to reproduce any issues. As you can see in the movie attached, everything works as expected in the regarded scenario.

Could you please tell me how your case is different from the shown on the movie? Do I follow all the necessary steps? The additional information will allow me to help you further.

Greetings,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Fabian
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or