System.NullReferenceException

6 posts, 0 answers
  1. Rabeeh
    Rabeeh  avatar
    62 posts
    Member since:
    Sep 2007

    Posted 04 Nov 2010 Link to this post

    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)



  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Nov 2010 Link to this post

    Hi,

    Please could you post the code that you are using to bind your data to the grid.
    Thanks
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Rabeeh
    Rabeeh  avatar
    62 posts
    Member since:
    Sep 2007

    Posted 04 Nov 2010 Link to this post

    The following is the code:

    List<
    UserInfo> usersList = this.GetCurrentActiveUsers();
     
    this.grid.DataSource = usersList;
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Nov 2010 Link to this post

    Hi,

    Nothing unusual there. Are any of the fields of the objects that you are binding to null?
    Richard
  6. Phi
    Phi avatar
    47 posts
    Member since:
    Dec 2008

    Posted 04 Nov 2010 Link to this post

    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");
  7. Svett
    Admin
    Svett avatar
    728 posts

    Posted 09 Nov 2010 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready