﻿<?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 - WebDesktop - How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</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>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Tue, 06 Nov 2012 08:05:01 GMT</pubDate><dc:creator>yudi</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;The WebGrid development team stated that this feature will be implemented in the next build version of WebGrid. I will send you the nightly build of the hotfix when the pre-release hotfix is ready to be evaluated.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;&lt;strong&gt;Edited on November 12, 2012 8:30 PM&lt;br /&gt;Reason: Update Latest Status of Task #974&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;WebGrid development team has managed to implement the feature.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;I'd like to introduce the "NewID" property of TransactionResult object. For your scenario, we need to set the value of NewID to the ID of the inserted object.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Below is the snippet code of InsertMethod in my WebService.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;[WebMethod]
public TransactionResult InsertShipper(Shipper newObject)
{
    NorthwindDataContext context = new NorthwindDataContext();
    WebGridDataProvider&amp;lt;Shipper&amp;gt; provider = new WebGridDataProvider&amp;lt;Shipper&amp;gt;(context.Shippers.AsQueryable());
    TransactionResult tresult = provider.Insert(newObject);
    tresult.NewID = newObject.ShipperID;
    return tresult;
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;This insert method will insert Shipper object. I'm using Shippers table of Northwind database in my simple sample. The table has ShipperID as the primary key and it is incremental primary key.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;After invoke the Insert(newObject) method, simply set the NewID property of the TransactionResult object and then return this object.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;There are points that need to be done in the WebGrid:&lt;/span&gt;&lt;/p&gt;
&lt;ul style="color: rgb(31, 73, 125);"&gt;&lt;li&gt;Please ensure that the DataKeyField of WebGrid's RootTable has been set correctly.&lt;br /&gt;Example:&lt;br /&gt;&lt;pre&gt;&amp;lt;ISWebGrid:WebGrid ID="WebGrid2" runat="server" ...&amp;gt;
    &amp;lt;LayoutSettings ...&amp;gt;
    &amp;lt;/LayoutSettings&amp;gt;
    &amp;lt;RootTable DataKeyField="ShipperID"&amp;gt;
        &amp;lt;Columns&amp;gt;
            ...
        &amp;lt;/Columns&amp;gt;
    &amp;lt;/RootTable&amp;gt;
    &amp;lt;ClientBindingSettings DataSourceType="WebService" ServiceUrl="WebService.asmx"
        ItemTypeName="Shipper"&amp;gt;
        &amp;lt;ServiceMethods SelectMethod="GetShippers" InsertMethod="InsertShipper" /&amp;gt;
    &amp;lt;/ClientBindingSettings&amp;gt;
&amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Set the DefaultValue property of the WebGridColumn to -1.&lt;br /&gt;Example:&lt;br /&gt;&lt;pre&gt;&amp;lt;Columns&amp;gt;
    &amp;lt;ISWebGrid:WebGridColumn Caption="ShipperID" DataMember="ShipperID" DataType="System.Int32"
        Name="ShipperID" Width="100px" EditType="NoEdit" DefaultValue="-1" IsAutoIncrement="true"&amp;gt;
    &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
    ...
&amp;lt;/Columns&amp;gt;&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;I have sent you a message to your registered email account. The message contains the link to download the nightly build of the hotfix and step by step to apply them manually.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;I have tested in a simple sample and found no problem so far. Please have the nightly build hotfix tested on your end and let us hear your feedback.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Sat, 03 Nov 2012 23:32:37 GMT</pubDate><dc:creator>mmikaeel2</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;I gave up on you guys, to be really honest, you have fantastic looking UI and also functionality, BUT you also have too many unnecessary issues and many perfromance issues, these problems really delay my development and also almost no fix for any issues I raised to you guys. I think I will have to switch to another UI without that much of issues, mostly Dev Express will do the job without these problems and issues.&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Tue, 23 Oct 2012 21:11:15 GMT</pubDate><dc:creator>yudi</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;I apologized for any inconvenience this problem may have caused you. Your feature request is already queued in our work items. I may be able to help raising the priority for your feature request.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;I’ll let you know any update I heard from the team regarding Task #974.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Mon, 22 Oct 2012 00:57:28 GMT</pubDate><dc:creator>mmikaeel2</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;Any update?!!&lt;/p&gt;&lt;p&gt;Its now over a year and NO fixe yet!! Can't belive you can't fix such issue!!&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Thu, 04 Oct 2012 21:24:16 GMT</pubDate><dc:creator>yudi</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;The status of Task #974 is on progress. When the nightly build of the hotfix is ready, I will let you know.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Wed, 03 Oct 2012 16:43:46 GMT</pubDate><dc:creator>mmikaeel2</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;Any update?!&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Tue, 07 Feb 2012 16:40:47 GMT</pubDate><dc:creator>yudi</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Task #974 has not been completed yet.&lt;br /&gt;I will let keep you informed with any news I heard from the team regarding task #974.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Mon, 06 Feb 2012 17:19:39 GMT</pubDate><dc:creator>mmikaeel2</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;Hi there,&lt;/p&gt;&lt;p&gt; Is this task (&lt;span style="font-family: 'segoe ui','sans-serif'; color: rgb(31, 73, 125); font-size: 9pt;"&gt;Task #974.&lt;/span&gt;) was done?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Maged&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Mon, 02 May 2011 06:38:13 GMT</pubDate><dc:creator>yudi</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;This feature request is already queued in our work items, Task #974.&lt;br /&gt;When the hotfix is ready, I’ll surely let you know and give you an example about how to use it.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Thu, 28 Apr 2011 01:13:28 GMT</pubDate><dc:creator>mmikaeel2</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;Was this addressed yet? If yes can you give me an example of how to use it?&lt;/p&gt;</description></item><item><title>How to pass back the new added row key value to webgrid in client bidning mode</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/How-to-pass-back-the-new-added-row-key-value-to-webgrid-in-client-bidning-mode/</link><pubDate>Tue, 15 Feb 2011 10:18:35 GMT</pubDate><dc:creator>mmikaeel2</dc:creator><category>webgrid clientbinding mode</category><description>&lt;p&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" LatentStyleCount="156"&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="undefined" style=""&gt;Hi,&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span lang="undefined" style=""&gt;&lt;span style=""&gt; &lt;/span&gt;I’ve WebGrid, and defined &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;courier new&amp;quot;; color: red;"&gt;BindingOperationMode&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;courier new&amp;quot;; color: blue;"&gt;="ClientBinding"
&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;courier new&amp;quot;; color: red;"&gt;AllowAddNew&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;courier new&amp;quot;; color: blue;"&gt;="Yes".&lt;/span&gt;&lt;span style=""&gt; &lt;span lang="undefined"&gt;Also set &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;courier new&amp;quot;; color: red;"&gt;DataSourceType&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;courier new&amp;quot;; color: blue;"&gt;="WebService".&lt;/span&gt;&lt;span style=""&gt; &lt;span style=""&gt; &lt;/span&gt;&lt;span lang="undefined" /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span lang="undefined" style=""&gt;I’ve this
code for the insert function in the webservice:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;private TransactionResult InsertMembershipTypePrice(MembershipTypePrice newObject, int nPriceType)&lt;br /&gt;    {&lt;br /&gt;        Medcan.Business.MembershipTypePrice price = new Medcan.Business.MembershipTypePrice();&lt;br /&gt;&lt;br /&gt;        price.MembershipTypeID  = newObject.MembershipTypeID;&lt;br /&gt;        price.IsActive          = newObject.IsActive;&lt;br /&gt;        price.EffectiveDate     = newObject.EffectiveDate;&lt;br /&gt;        price.EndDate           = newObject.EndDate;&lt;br /&gt;        price.Description       = newObject.Description;&lt;br /&gt;        price.PriceFlag         = nPriceType;&lt;br /&gt;&lt;br /&gt;        price.MemberCategory = GetComboConfigID(newObject.MemberCategoryName, "MembershipCategory");&lt;br /&gt;        Decimal nTemp = 0;&lt;br /&gt;        Decimal.TryParse(newObject.MemberPrice, out nTemp);&lt;br /&gt;        price.MemberPrice = nTemp;&lt;br /&gt;&lt;br /&gt;        using (TransactionScope scope = new TransactionScope())&lt;br /&gt;        {&lt;br /&gt;            price.Save();&lt;br /&gt;            newObject.MembershipTypePriceID = price.MembershipTypePriceID;&lt;br /&gt;            scope.Complete();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        MembershipDataContext context = new MembershipDataContext();&lt;br /&gt;        return new TransactionResult()&lt;br /&gt;        {&lt;br /&gt;            OperationType   = DataSourceOperation.Insert,&lt;br /&gt;            ReturnValue     = true,&lt;br /&gt;            AffectedResults = newObject.MembershipTypePriceID&lt;br /&gt;        };&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" LatentStyleCount="156"&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="undefined" style=""&gt;How can the
grid recognize the new added row key value, like when I add a new record in the
database, how can I pass back the new row key value to the grid?&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span lang="undefined" style=""&gt;Thanks,&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span lang="undefined" style=""&gt;Maged
Mikaeel&lt;/span&gt;&lt;/p&gt;
</description></item></channel></rss>