﻿<?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 - Missing Pending Changes on ChildRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Missing-Pending-Changes-on-ChildRow/</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>Missing Pending Changes on ChildRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Missing-Pending-Changes-on-ChildRow/</link><pubDate>Fri, 06 Aug 2010 10:41:39 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Thanks Niven, it works now.&lt;/p&gt;</description></item><item><title>Missing Pending Changes on ChildRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Missing-Pending-Changes-on-ChildRow/</link><pubDate>Thu, 05 Aug 2010 04:28:03 GMT</pubDate><dc:creator>niven</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hello Guilermo,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;After I look into your codes, there's happened to be a mistake.&lt;/p&gt;
&lt;p&gt;Please delete this 3 lines&lt;/p&gt;&lt;pre&gt;row.SetDataChanged();
row.AcceptChanges();
grid.MarkEdit();&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 13px"&gt;and change it into&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;row.AddPendingChanges();
grid.UpdatePendingChangesStatus();&lt;/pre&gt;
&lt;p&gt;When you have a case which deal with a database please update it using these 2 commands.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Hope this can resolve your issue.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Niven Prasetya&lt;/p&gt;</description></item><item><title>Missing Pending Changes on ChildRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Missing-Pending-Changes-on-ChildRow/</link><pubDate>Wed, 04 Aug 2010 14:18:07 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I'm trying to modify some records on a childrow from the parentrow in a hierarchical grid with batch update (as reference, I'm using part of the answer for some another reply I got in this &lt;a href="http://www.intersoftpt.com/Community/WebGrid/Expand-Child-Row--Access-RowChecker-on-ChildRows/" target="_blank"&gt;thread&lt;/a&gt; ).&lt;/p&gt;
&lt;p&gt;Problem is, when I'm picking the BatchUpdate event not all the changes are showing up on the BatchUpdateEventArgs.PendingChanges collection, only the changes on the parent rows are there. I'm clicking the rowchecker on the parent row and that's supposed to trigger some changes on both the parent and its children. I think this might be an issue with the code I'm using to "commit the change" on the rows.&lt;/p&gt;
&lt;p&gt;This is in my javascript event:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;function webGrid_CheckBoxClick(gridId, tblName, colName, checkboxValue, originalCheckBoxValue) {
        var grid = ISGetObject(gridId);
        var row = grid.Tables[tblName].ToRowObject(grid.CheckedRowContext);
        if (colName == 'Checker') {
            var newCountryName = row.GetCell('CountryName').Text &amp;#43; "_New";
            row.GetCell('CountryName').SetValue(newCountryName);
            row.GetCell('CountryName').SetText(newCountryName);
            row.GetCell('Active').CellElement.childNodes[0].click();            
            
            //Expand child
            if (!row.ChildExpanded) {
                row.ExpandChildRow(true);
            }
            //If no childs return
            var childRows = row.GetChildRows("Capital");
            if (childRows == null) {
                return;
            }
            //Check all childs and retrigger function
            for (var i = 0; i &amp;lt; childRows.length; i&amp;#43;&amp;#43;) {
                childRows[i].Check();
            }
            row.SetDataChanged();
            row.AcceptChanges();
            grid.MarkEdit();
        }
        else if (colName == 'CapitalChecker') {
            var newCapitalName = row.GetCell('CapitalName').Text &amp;#43; "_New";
            row.GetCell('CapitalName').SetValue(newCapitalName);
            row.GetCell('CapitalName').SetText(newCapitalName);
            row.GetCell('CapitalActive').CellElement.childNodes[0].click();
            row.SetDataChanged();
            row.AcceptChanges();
            grid.MarkEdit();
        }
    }&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;And this is my grid definition:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;&amp;lt;ISNet:WebGrid ID="webGrid" runat="server" UseDefaultStyle="true" OnInitializeDataSource="webGrid_IDS" OnBatchUpdate="webGrid_BU"&amp;gt;
        &amp;lt;RootTable DataMember="Country" DataKeyField="CountryID"&amp;gt;
            &amp;lt;Columns&amp;gt;
                &amp;lt;ISNet:WebGridColumn ColumnType="CheckBox" IsRowChecker="true" Name="Checker" Bound="false" /&amp;gt;
                &amp;lt;ISNet:WebGridColumn DataMember="CountryID" Name="CountryID" /&amp;gt;
                &amp;lt;ISNet:WebGridColumn DataMember="CountryName" Name="CountryName" /&amp;gt;
                &amp;lt;ISNet:WebGridColumn DataMember="Active" Name="Active" /&amp;gt;
            &amp;lt;/Columns&amp;gt;
            &amp;lt;ChildTables&amp;gt;
                &amp;lt;ISNet:WebGridTable DataMember="Capital" DataKeyField="CapitalID" &amp;gt;
                    &amp;lt;Columns&amp;gt;
                        &amp;lt;ISNet:WebGridColumn ColumnType="CheckBox" IsRowChecker="true" Name="CapitalChecker" Bound="false" /&amp;gt;
                        &amp;lt;ISNet:WebGridColumn DataMember="CapitalID" Name="CapitalID" /&amp;gt;
                        &amp;lt;ISNet:WebGridColumn DataMember="CapitalName" Name="CapitalName" /&amp;gt;
                        &amp;lt;ISNet:WebGridColumn DataMember="Active" Name="CapitalActive" /&amp;gt;
                    &amp;lt;/Columns&amp;gt;
                &amp;lt;/ISNet:WebGridTable&amp;gt;
            &amp;lt;/ChildTables&amp;gt;
        &amp;lt;/RootTable&amp;gt;
        &amp;lt;LayoutSettings AllowBatchUpdate="true" AllowEdit="Yes" Hierarchical="true"&amp;gt;
            &amp;lt;ClientSideEvents OnCheckBoxClick="webGrid_CheckBoxClick"/&amp;gt;
            &amp;lt;BatchUpdateSettings PromptUnsavedChanges="false" /&amp;gt;
        &amp;lt;/LayoutSettings&amp;gt;
    &amp;lt;/ISNet:WebGrid&amp;gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;And this is in my code behind:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;protected void webGrid_IDS(object sender, DataSourceEventArgs e)
        {
            e.DataSource = GetDataSet();
        }
        protected void webGrid_BU(object sender, BatchUpdateEventArgs e)
        {
            var changeCount = e.PendingChanges.Count;
            var changeCollection = e.PendingChanges;
            foreach (var change in changeCollection)
            { 
            } 
        }
        protected void btnBatchUpdate_Click(object sender, EventArgs e)
        {
            webGrid.PerformBatchUpdate(false);
        }
        private DataSet GetDataSet()
        {
            DataSet test = new DataSet();
            DataTable country = test.Tables.Add("Country");
            DataTable capital = test.Tables.Add("Capital");
            country.Columns.Add("CountryID", typeof(int));
            country.Columns.Add("CountryName", typeof(string));
            country.Columns.Add("Active", typeof(bool));
            capital.Columns.Add("CapitalID", typeof(int));
            capital.Columns.Add("CountryID", typeof(int));
            capital.Columns.Add("CapitalName", typeof(string));
            capital.Columns.Add("Active", typeof(bool));
            country.Rows.Add(1, "France", false);
            country.Rows.Add(2, "Spain", false);
            capital.Rows.Add(10, 1, "Paris", false);
            capital.Rows.Add(20, 2, "Madrid", false);
            test.Relations.Add(new DataRelation("CountryCapital", country.Columns[0], capital.Columns[1]));
            return test;
        }&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks for any feedback on this&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>