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

Grid Crashes, exception no help.

3 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vik
Top achievements
Rank 1
Vik asked on 17 Jul 2008, 05:58 PM
I select a couple of check boxes on the grid rows and do a button click. before the code on the button executes, the grid crashes with a unhelpful exception message. Anybody have a clue,

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

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. 

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.WebControls.GridClientChangesLoader.UpdateSelectedRows(GridTableView currTableView, String controlId, Int32 rowIndex) +62
   Telerik.WebControls.GridClientChangesLoader.LoadSelectedRows(String selectedRows) +257
   Telerik.WebControls.GridClientChangesLoader.LoadChanges(String argument, NameValueCollection collection) +1073
   Telerik.WebControls.RadGrid.LoadPostData(String postDataKey, NameValueCollection postCollection) +428
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +661
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194

 

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 18 Jul 2008, 01:24 PM
Hi Vik,

This is most probably an error caused by improper RadGrid initialization. Could you, please, provide some code samples we can examine on how RadGrid was initialized on the page.

Regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JL
Top achievements
Rank 1
answered on 22 Sep 2008, 12:06 PM
Hi.

I've found the problem happens (in my specific case, at least) if the grid isn't re-bound to the datasource, for instance when a postback happens (may also be a problem within a callback).

The actual error that was raised is misleading, making me believe it was a problem with the RadGrid itself, as the exception didn't indicate a databinding problem.

I've made sure the grid is rebound to my datasource when a postback happens (fired when the user clicks a server button), and the problem is resolved!!

Hope this helps.
0
Veli
Telerik team
answered on 25 Sep 2008, 11:13 AM
Hello JL,

Please bind RadGrid to your data source in the NeedDataSource event to make sure RadGrid can successfully rebind whenever it needs to.

Sincerely yours,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Vik
Top achievements
Rank 1
Answers by
Veli
Telerik team
JL
Top achievements
Rank 1
Share this question
or