Editing a row just after is was added

9 replies. Last post: April 20, 2014 9:38 PM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

With WebGrid 8, just after inserting a new row, if I try to edit it, when the update code is supposed to run, I get : 

Server Error in '/' Application.

Object reference not set to an instance of an object.

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.]

   ISNet.WebUI.WebGrid.WebGridTable.IsKeyValueEqual(WebGridRow row, Object oKeyValues) +149

   ..(DataView , XmlNode ) +2559

   ..(DataView , String ) +1200

   ..(DataView , String , String ) +1466

   ..DataBind(Object , String ) +1584

   ISNet.WebUI.WebGrid.WebGrid.() +183

   ISNet.WebUI.ISNetControl.ControlRequestHandler(Object , EventArgs ) +303

[Exception: Object reference not set to an instance of an object.]

   ISNet.WebUI.ISNetControl.ControlRequestHandler(Object , EventArgs ) +578

   System.EventHandler.Invoke(Object sender, EventArgs e) +0

   System.Web.UI.Control.OnPreRender(EventArgs e) +92

   System.Web.UI.Control.PreRenderRecursiveInternal() +83

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974


In the AddRow handler, I insert the new line in SQL Server. The Key is autogenerated by SQL Server. 

Then I read this new Key and set in the Value of the corresponding WebGridCell in the new row. 

Is there something else I need to do to correctly set the row's DataKeyField?


Thank you,



All times are GMT -5. The time now is 11:28 AM.
Previous Next