﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Thu, 07 Oct 2010 16:18:57 GMT</pubDate><dc:creator>sarslan</dc:creator><description>&lt;p&gt;i fixed my problem. cause of the problem is empty DataKeyField of RootTable.&lt;/p&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Thu, 07 Oct 2010 15:56:56 GMT</pubDate><dc:creator>sarslan</dc:creator><description>&lt;p&gt;i have same problem while update operation. are there any solution for about this problem?&lt;/p&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Tue, 23 Mar 2010 06:17:10 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Thank you for the sample, I have sucessfully replicate the issue.&lt;/p&gt;&lt;p&gt;However, I am still discussing the issue with our developer. I will inform you if I have any update or progress regarding this issue.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:26:57 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Sorry for so many Replies.&lt;/p&gt;
&lt;p&gt;It takes a while to figure out what characters this app does not like.  Something non-printable.&lt;/p&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:25:38 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;pre&gt;   ISNet.WebUI.WebGrid.DataBinding.(DataView dataSource, String dataMember, String request) &amp;#43;776
   ISNet.WebUI.WebGrid.DataBinding.DataBind(Object dataSource, String dataMember) &amp;#43;606
   ISNet.WebUI.WebGrid.WebGrid.() &amp;#43;46
   ISNet.WebUI.ISNetControl.ControlRequestHandler(Object sender, EventArgs e) &amp;#43;304

[Exception: Object reference not set to an instance of an object.]
   ISNet.WebUI.ISNetControl.ControlRequestHandler(Object sender, EventArgs e) &amp;#43;457
   System.Web.UI.Control.OnPreRender(EventArgs e) &amp;#43;8682870
   System.Web.UI.Control.PreRenderRecursiveInternal() &amp;#43;80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean 

includeStagesAfterAsyncPoint) &amp;#43;842




Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082 &lt;/pre&gt;
</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:25:15 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;pre&gt;   ISNet.WebUI.WebGrid.DataBinding.(DataView dataSource, String request) &amp;#43;851
&lt;/pre&gt;
</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:24:36 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;pre&gt;   ISNet.WebUI.WebGrid.DataBinding.  (DataView view, XmlNode xReq) &amp;#43;1396
&lt;/pre&gt;
</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:23:26 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;pre&gt;[NullReferenceException: Object reference not set to an instance of an object.]
   ISNet.WebUI.WebGrid.WebGridTable.IsKeyValueEqual(WebGridRow row, Object oKeyValues) &amp;#43;97&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:14:17 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Error:&lt;/p&gt;&lt;pre&gt;Server Error in '/NewCoServices' 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: 


&lt;/pre&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:12:20 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Code:&lt;/p&gt;&lt;pre&gt;&amp;lt;%@ Page Language="C#" %&amp;gt;

&amp;lt;%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;

	&amp;lt;ISWebGrid:WebGrid
		ID="PartsDetail_WebGrid"
		runat="server"
		UseDefaultStyle="True"
		DataSourceID="PartsDetail_SQLDataSource"
		Height="250px"
		Width="100%"
	&amp;gt;
		&amp;lt;LayoutSettings
			AllowAddNew="Yes"
			AllowDelete="Yes"
			AllowEdit="Yes"
			AllowSorting="Yes"
			Hierarchical="false"
		&amp;gt;
			&amp;lt;ClientSideEvents
			/&amp;gt;
		&amp;lt;/LayoutSettings&amp;gt;
		&amp;lt;RootTable
			DataKeyField="PARTS_DETAIL_ID"
		&amp;gt;
			&amp;lt;Columns&amp;gt;
				&amp;lt;ISWebGrid:WebGridColumn
					Name="PartsOrderNumber_WebGridColumn" 
					DataMember="PARTS_ORDER_NUM"
					DataType="System.Int32"
					Width="100px"
					Visible="false"
				&amp;gt;
				&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
				&amp;lt;ISWebGrid:WebGridColumn
					Name="PartNumber_WebGridColumn"
					DataMember="PART_NUMBER"
					InputRequired="true"
					Width="130px"
				&amp;gt;
				&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
				&amp;lt;ISWebGrid:WebGridColumn
					Name="PartDescription_WebGridColumn"
					DataMember="PART_DESCRIPTION"
					InputRequired="true"
					Width="300px"
				&amp;gt;
				&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
				&amp;lt;ISWebGrid:WebGridColumn
					Name="PartQuantity_WebGridColumn"
					DataMember="QUANTITY"
					DataType="System.Int32"
					InputRequired="true"
					Width="70px"
				&amp;gt;
				&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
				&amp;lt;ISWebGrid:WebGridColumn
					Name="PartPrice_WebGridColumn"
					DataMember="PART_PRICE"
					DataType="System.Decimal"
					InputRequired="true"
					Width="80px"
				&amp;gt;
				&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
			&amp;lt;/Columns&amp;gt;
		&amp;lt;/RootTable&amp;gt;
	&amp;lt;/ISWebGrid:WebGrid&amp;gt;
		
	&amp;lt;asp:SqlDataSource
		ID="PartsDetail_SqlDataSource"
		runat="server"
		ConnectionString='&amp;lt;%$ ConnectionStrings:NewCoAppSample %&amp;gt;'
		SelectCommand="
						SELECT
								PD.PARTS_DETAIL_ID
							,	PD.PARTS_ORDER_NUM
							,	PD.QUANTITY
							,	PD.PART_NUMBER
							,	PD.PART_DESCRIPTION
							,	PD.PART_PRICE
						FROM
							PARTS_DETAIL	PD
						WHERE
							PD.PARTS_ORDER_NUM	= 5
						"
		DeleteCommand="
						DELETE
							FROM PARTS_DETAIL
						WHERE
							PARTS_DETAIL_ID	= @PARTS_DETAIL_ID
						"
		UpdateCommand="
						UPDATE
							PARTS_DETAIL
						SET
							PART_NUMBER			= @PART_NUMBER
						,	PART_DESCRIPTION	= @PART_DESCRIPTION
						,	QUANTITY			= @QUANTITY
						,	PART_PRICE			= @PART_PRICE
						WHERE
							PARTS_DETAIL_ID	= @PARTS_DETAIL_ID
						"
		InsertCommand="
						INSERT INTO
							PARTS_DETAIL
						(
							PARTS_ORDER_NUM
						,	PART_NUMBER
						,	PART_DESCRIPTION
						,	QUANTITY
						,	PART_PRICE
						)
						VALUES
						(
							5
						,	@PART_NUMBER
						,	@PART_DESCRIPTION
						,	@QUANTITY
						,	@PART_PRICE
						)
						"
	&amp;gt;
		&amp;lt;InsertParameters&amp;gt;
			&amp;lt;asp:Parameter Name="QUANTITY" Type="Decimal" /&amp;gt;
			&amp;lt;asp:Parameter Name="PART_NUMBER" Type="String" /&amp;gt;
			&amp;lt;asp:Parameter Name="PART_DESCRIPTION" Type="String" /&amp;gt;
			&amp;lt;asp:Parameter Name="PART_PRICE" Type="Decimal" /&amp;gt;
		&amp;lt;/InsertParameters&amp;gt;
		&amp;lt;SelectParameters&amp;gt;
		&amp;lt;/SelectParameters&amp;gt;
		&amp;lt;UpdateParameters&amp;gt;
			&amp;lt;asp:Parameter Name="QUANTITY" Type="Decimal" /&amp;gt;
			&amp;lt;asp:Parameter Name="PART_NUMBER" Type="String" /&amp;gt;
			&amp;lt;asp:Parameter Name="PART_DESCRIPTION" Type="String" /&amp;gt;
			&amp;lt;asp:Parameter Name="PART_PRICE" Type="Decimal" /&amp;gt;
		&amp;lt;/UpdateParameters&amp;gt;
	&amp;lt;/asp:SqlDataSource&amp;gt;
		
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;</description></item><item><title>Update a Newly Inserted Row fails with " Object reference not set to an instance of an object."</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Update-a-Newly-Inserted-Row-fails-with--Object-reference-not-set-to-an-instance-of-an-object/</link><pubDate>Mon, 22 Mar 2010 15:11:04 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;Hi,&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;I have a WebGrid using a SQLDataSource.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;When trying to Update a Newly Inserted Row, it fails with " Object reference not set to an instance of an object."&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;There exists a SQL Insert Trigger, when it is not used, Updates on a Newly Inserted Row works.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;Glenn has a working copy of the database an I have just provided him with the Trigger.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;As a workaround, after refreshing the WebGrid, there is no problem even with the SQL Insert Trigger.&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;Why is this happening?&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;Is there a better solution?&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;Doug&lt;/span&gt;&lt;/p&gt;
</description></item></channel></rss>