﻿<?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 - selectedRow.Update() Exception</title><link>http://www.intersoftsolutions.com/Community/WebGrid/selectedRowUpdate-Exception/</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>selectedRow.Update() Exception</title><link>http://www.intersoftsolutions.com/Community/WebGrid/selectedRowUpdate-Exception/</link><pubDate>Wed, 10 Feb 2010 15:44:49 GMT</pubDate><dc:creator>Peter</dc:creator><category>WebGrid</category><category>XP</category><category>SelectedRow</category><category>Update</category><category>Exception</category><description>&lt;p&gt;Thanks, it worked &lt;/p&gt;</description></item><item><title>selectedRow.Update() Exception</title><link>http://www.intersoftsolutions.com/Community/WebGrid/selectedRowUpdate-Exception/</link><pubDate>Tue, 09 Feb 2010 22:40:14 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><category>WebGrid</category><category>XP</category><category>SelectedRow</category><category>Update</category><category>Exception</category><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi Peter,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Yes, the code that you have provided is almost correct. But to set the auto value of column, we will need to use SetText instead of SetValue. And also, we do not need to get the selected object and so on, because on OnBeforeAdd event, it will pass the rowObject, so we can just use that particular object. &amp;nbsp;Here is the snippet to do so:&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;  function WebGrid1_OnBeforeAdd(controlId, tblName, rowObject)
        {
            var WebGrid1 = ISGetObject(controlId);
            var cells = rowObject.GetCells();
            var getCell = cells.GetNamedItem("Description");
            getCell.SetText("This is an auto fill", true)
                     
            return true;
        }&lt;/pre&gt;
&lt;p&gt;    &lt;span style="font-size: 9pt; "&gt; &amp;nbsp;I hope it helps and please, do not hesitate to ask if you have any other questions. Thank you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>selectedRow.Update() Exception</title><link>http://www.intersoftsolutions.com/Community/WebGrid/selectedRowUpdate-Exception/</link><pubDate>Tue, 09 Feb 2010 05:48:56 GMT</pubDate><dc:creator>Peter</dc:creator><category>WebGrid</category><category>XP</category><category>SelectedRow</category><category>Update</category><category>Exception</category><description>&lt;p&gt;Hi &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I am attempting to set some default values on the client side when a new row is added to a bound WebGrid. However, when I update the row I get an error message. The cell and DB column behind, that I am writing to, is a string. If I type in the very same string, rather than setting it in the script, it works. The exception occurs during selectedRow.Update().&lt;br /&gt;&lt;/p&gt;Hope you can help:&lt;br /&gt;&lt;br /&gt;Client script:&lt;br /&gt;function OnBeforeAdd(controlId, tblName, rowIndex, rowEl) {&lt;br /&gt;
&lt;p&gt; var WebGrid1 = ISGetObject(controlId);&lt;br /&gt; var selectedRow = WebGrid1.GetSelectedObject().ToRowObject();&lt;br /&gt; var cells = selectedRow.GetCells();&lt;br /&gt; cells.GetNamedItem("Description").SetValue("jubii");&lt;br /&gt; selectedRow.Update();&lt;br /&gt; &lt;br /&gt; return true;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;Error message: (see also attached screendump)&lt;/p&gt;
&lt;p&gt;Server Error '/' Application&lt;/p&gt;
&lt;p&gt;Input String was not in a correct format&lt;/p&gt;
&lt;p&gt;Peter&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>