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

System.NullReferenceException

5 Answers 606 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rabeeh
Top achievements
Rank 2
Rabeeh asked on 04 Nov 2010, 10:10 AM
Hi, I have the latest Telerik controls, I am using it for some time, currently I changed the method content that returns List<MyDataObject>, I started receiving exceptions from the Grid after data binding.

I am receiving System.NullReferenceException from the Grid
 
What does this mean ? what should I check for ?

[System.NullReferenceException] = {"Object reference not set to an instance of an object."}
 
Source: Telerik.WinControls.GridView
 
Stack Trace:
   at Telerik.WinControls.UI.GridVisualElement.GetElementAtPoint[T](ComponentElementTree componentTree, Point point)
   at Telerik.WinControls.UI.GridRowBehavior.GetRowAtPoint(Point point)
   at Telerik.WinControls.UI.GridRowBehavior.SelectPositionOnMouseDownLeft(MouseEventArgs e, GridRowElement rowElement, GridCellElement cellElement)
   at Telerik.WinControls.UI.GridRowBehavior.OnMouseDownLeft(MouseEventArgs e)
   at Telerik.WinControls.UI.GridRowBehavior.OnMouseDown(MouseEventArgs e)
   at Telerik.WinControls.UI.BaseGridBehavior.OnMouseDown(MouseEventArgs e)
   at Telerik.WinControls.UI.RadGridView.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(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)



5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 04 Nov 2010, 10:52 AM
Hi,

Please could you post the code that you are using to bind your data to the grid.
Thanks
Richard
0
Rabeeh
Top achievements
Rank 2
answered on 04 Nov 2010, 11:33 AM
The following is the code:

List<
UserInfo> usersList = this.GetCurrentActiveUsers();
 
this.grid.DataSource = usersList;
0
Richard Slade
Top achievements
Rank 2
answered on 04 Nov 2010, 11:36 AM
Hi,

Nothing unusual there. Are any of the fields of the objects that you are binding to null?
Richard
0
Phi
Top achievements
Rank 1
answered on 04 Nov 2010, 02:09 PM
Since you changed the method content that returns List<MyDataObject>, I would suspect that that method could return a null List! I would suggest you look at that method or do the following:

List<UserInfo> usersList = this.GetCurrentActiveUsers();
  
if (usersLists != null)
   this.grid.DataSource = usersList;
else
   RadMessageBox.Show("opps! userLists is null");
0
Svett
Telerik team
answered on 09 Nov 2010, 06:32 PM
Hello Phi,

We are not able to reproduce the issue with the latest release Q2 2010 SP2 (2010.2 10.914). Please open a new support ticket and send me a sample project where the issue occurs. This will allow us to investigate the case further and provide you with further assistance.

Greetings,
Svett
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Rabeeh
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Rabeeh
Top achievements
Rank 2
Phi
Top achievements
Rank 1
Svett
Telerik team
Share this question
or