Object reference not set to an instance of an object. at Telerik.WinControls.UI.GridViewEditManager.OnPositionChanging

4 posts, 0 answers
  1. CHRIS
    CHRIS avatar
    2 posts
    Member since:
    Sep 2013

    Posted 09 Sep 2013 Link to this post

    Telerik.WinControls.GridView version 2012.3.1211.20

    Hi Everyone,

    I am using GridView's RowSourceNeeded to populate child table when [+] is clicked... it works fine when initial load, however when master table gets refreshed by assigning the DataSource to different collection, it throws following error when [+] is clicked to populate child table.
    It seems the child table was populated OK, but it still throws the exception anyway.

    Any help/suggestions/ideas are appreciated greatly.  Thank you.

    System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.WinControls.UI.GridViewEditManager.OnPositionChanging(PositionChangingEventArgs args)
       at Telerik.WinControls.UI.GridViewEditManager.Telerik.WinControls.UI.IGridViewEventListener.PreProcessEvent(GridViewEvent eventData)
       at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode)
       at Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent)
       at Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents()
       at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent)
       at Telerik.WinControls.UI.GridViewSynchronizationService.RaiseCurrentChanged(GridViewTemplate template, GridViewRowInfo row, GridViewColumn column, Boolean user)
       at Telerik.WinControls.UI.GridViewRowInfo.OnIsCurrentPropertyChanging(PropertyChangingEventArgsEx args)
       at Telerik.WinControls.UI.GridViewRowInfo.OnPropertyChanging(PropertyChangingEventArgsEx args)
       at Telerik.WinControls.UI.GridViewHierarchyRowInfo.OnPropertyChanging(PropertyChangingEventArgsEx args)
       at Telerik.WinControls.UI.GridViewRowInfo.SetBooleanProperty(String propertyName, Int32 propertyKey, Boolean value)
       at Telerik.WinControls.UI.MasterGridViewTemplate.ChangeCurrentRow(GridViewRowInfo oldRow, GridViewRowInfo row, GridViewTemplate viewTemplate)
       at Telerik.WinControls.UI.MasterGridViewTemplate.SetPositionCore(GridViewRowInfo newRow, GridViewColumn newColumn, GridViewRowInfo oldRow, GridViewColumn oldColumn, Boolean validateRowChange)
       at Telerik.WinControls.UI.MasterGridViewTemplate.SetPosition(GridViewRowInfo row, GridViewColumn column, Boolean validateRowChange)
       at Telerik.WinControls.UI.MasterGridViewTemplate.ProcessCurrentChanged(GridViewEvent eventData)
       at Telerik.WinControls.UI.MasterGridViewTemplate.ProcessEventCore(GridViewEvent eventData)
       at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode)
       at Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent)
       at Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents()
       at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent)
       at Telerik.WinControls.UI.GridViewSynchronizationService.RaiseCurrentChanged(GridViewTemplate template, GridViewRowInfo row, GridViewColumn column, Boolean user)
       at Telerik.WinControls.UI.BaseGridNavigator.SelectCore(GridViewRowInfo row, GridViewColumn column)
       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. George
    Admin
    George avatar
    500 posts

    Posted 12 Sep 2013 Link to this post

    Hello Chris,

    Thank you for contacting Telerik Support.

    You should not change the DataSource in the RowSourceNeeded event. You can either only add/remove rows or try to replace the collection on the ChildViewExpanded event. Additionally you can read more about Load-On-Demand in this help article - http://www.telerik.com/help/winforms/gridview-hierarchical-grid-load-on-demand-hierarchy.html.

    If you still experience issues, feel free to contact me back with a sample project which can help me get your idea and properly investigate your case.

    I hope this helps.

    Regards,
    George
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. CHRIS
    CHRIS avatar
    2 posts
    Member since:
    Sep 2013

    Posted 12 Sep 2013 Link to this post

    Hi George,

    Thanks for the reply.

    The problem was not really caused by RowSourceNeeded event.

    I have two gridviews and they shared same Child templates and HierachyDataProvider...

    I created dedicated Child templates and HierachyDataProvider for each GridView and the exception seems gone.

    Regards,


    Chris
  4. George
    Admin
    George avatar
    500 posts

    Posted 17 Sep 2013 Link to this post

    Hi Chris,

    I am glad that you resolved your issue.

    Should you have any other questions, do not hesitate to ask.
     
    Regards,
    George
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top