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

LoadControlState Error under certain postback conditions

1 Answer 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 02 Sep 2016, 07:25 PM
We are using Telerik's radgrid for a Kentico site.  We're having a major problem with the user's dashboard.  When a user adds the data grid widget to their dashboard, it posts back and there's the grid. IF they then add a second one, it throws the below error.
If they add a grid, then after it post back, revisits the page, they can add another with no issue.  Same goes for deletions of the widgets, they can delete the first, but if they don't revisit the page so it's not a postback, it throws an error.
The error seems to be occurring in the grid between the Load and Prerender, probably with the PostbackChangeNotification or PostbackEvent.
I can't get the debugger to catch it at all.  There are save and load states in the code, here's the error and some of the code.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.GridTableView.LoadControlState(Object savedState) +121
   System.Web.UI.Control.LoadControlStateInternal(Object savedStateObj) +136
   System.Web.UI.Page.RegisterRequiresControlState(Control control) +12314028
   Telerik.Web.UI.GridTableViewBase.OnInit(EventArgs e) +59
   Telerik.Web.UI.GridTableView.OnInit(EventArgs e) +1564
   System.Web.UI.Control.InitRecursive(Control namingContainer) +185
   System.Web.UI.Control.AddedControl(Control control, Int32 index) +188
   Telerik.Web.UI.RadGrid.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +115
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +94
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +221
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +312
   Telerik.Web.UI.RadGrid.DataBind() +27
   Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +2700
   Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +223
   System.Web.UI.Control.LoadRecursive() +70
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Control.LoadRecursive() +189
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3177

Here's the files master control, the control, and some of the headers from the attempted requests: http://www.filedropper.com/showdownload.php/files_7 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 07 Sep 2016, 01:44 PM
Hello Trevor,

I'm afraid integrating Telerik controls with third party products and environments is beyond our support scope. Nevertheless, you can check the following resources for creating and adding the RadGrid control programmatically:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/creating-a-radgrid-programmatically#creating-a-radgrid-on-page_init
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/changing-the-grid-structure-dynamically-on-postback

Regards,
Eyup
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Trevor
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or