Completed
Last Updated: 02 May 2019 08:47 by ADMIN
Release R2 2019
Brandon
Created on: 01 Apr 2019 09:51
Category: GridView
Type: Bug Report
1
RadGridView: NullReferenceException when setting the TableElement.PageViewMode to Backstage or NavigationView

Please run the attached sample project and try to expand a row. The following error occurs:

System.NullReferenceException was unhandled by user code
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Telerik.WinControls.GridView
  StackTrace:
       at Telerik.WinControls.UI.GridDetailViewRowElement.Detach()
       at Telerik.WinControls.UI.GridRowElement.DisposeManagedResources()
       at Telerik.WinControls.DisposableObject.PerformDispose(Boolean disposing)
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.RadElement.DisposeChildren()
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.RadElement.DisposeChildren()
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.RadElement.DisposeChildren()
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.RadElement.DisposeChildren()
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.RadElement.DisposeChildren()
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.RadElement.DisposeChildren()
       at Telerik.WinControls.RadElement.PerformDispose(Boolean disposing)
       at Telerik.WinControls.DisposableObject.Dispose(Boolean disposing)
       at Telerik.WinControls.ComponentThemableElementTree.Dispose(Boolean disposing)
       at Telerik.WinControls.RadControl.Dispose(Boolean disposing)
       at Telerik.WinControls.UI.RadGridView.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.Form.Dispose(Boolean disposing)
       at Telerik.WinControls.UI.RadFormControlBase.Dispose(Boolean disposing)
       at Telerik.WinControls.UI.RadForm.Dispose(Boolean disposing)
       at _1401918_GridHierarchyPageViewMode.RadForm1.Dispose(Boolean disposing) in d:\Projects\1401918 GridHierarchyPageViewMode\RadForm1.Designer.cs:line 20
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.ApplicationContext.Dispose(Boolean disposing)
       at System.Windows.Forms.Application.ThreadContext.DisposeThreadWindows()
  InnerException: 

1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 01 Apr 2019 10:25
Hello, Brandon,  

Thank you for reporting this.

I have logged it in our feedback portal by making this public thread. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to eliminate the error is to create the following custom GridDetailViewCellElement. However, have in mind that it need to be implemented additional functionality in RadGridView for the Backstage and Navigation views.

private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridDetailViewCellElement))
    {
        e.CellElement = new CustomGridDetailViewCellElement(e.Column, e.Row);
    }
}
 
public class CustomGridDetailViewCellElement : GridDetailViewCellElement
{
    public CustomGridDetailViewCellElement(GridViewColumn column, GridRowElement row) : base(column, row)
    {
    }
 
    protected override IRadPageViewProvider CreatePageViewProvider()
    {
        IRadPageViewProvider provider = base.CreatePageViewProvider();
        if (provider == null)
        {
            provider = new RadPageViewStripProvider();
        }
        return provider;
    }
}

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.