﻿<?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 - Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</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>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Wed, 17 Nov 2010 21:25:27 GMT</pubDate><dc:creator>yudi</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;To Daniele Barbini and Jaques Els:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;We are willing to advice you further but in order to do so we would need you to elaborate on your specific scenario and possibly give us a step-by-step guide that we can use to observe the problematic behavior.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Wed, 17 Nov 2010 12:08:34 GMT</pubDate><dc:creator>FatOldSun</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;None of this works...&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;span style="font-size: 13px"&gt;&lt;/span&gt;&lt;span style="font-size: 13px; color: #008000"&gt;&lt;span style="font-size: 13px; color: #008000"&gt;WebGridAssets.ClearCachedDataSource();
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;&lt;/span&gt;&lt;span style="font-size: 13px; color: #008000"&gt;&lt;span style="font-size: 13px; color: #008000"&gt;WebGridAssets.RebindDataSource();
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;&lt;/span&gt;&lt;span style="font-size: 13px; color: #008000"&gt;&lt;span style="font-size: 13px; color: #008000"&gt;WebGridAssets.ClientAction.Refresh();
&lt;/span&gt;&lt;/span&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Wed, 17 Nov 2010 12:04:40 GMT</pubDate><dc:creator>FatOldSun</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;RE:  &lt;/p&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'consolas', 'courier new'"&gt;function&lt;/span&gt; &lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;refreshChild() {&lt;/span&gt;
    &lt;span style="font-size: 9pt; color: blue; font-family: 'consolas', 'courier new'"&gt;var&lt;/span&gt; &lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;grid = ISGetObject(&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'consolas', 'courier new'"&gt;"WebGrid1"&lt;/span&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;);
    grid.Tables[&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'consolas', 'courier new'"&gt;"Orders"&lt;/span&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;].Refresh();
}&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;I am using ObjectDataSource.   I do not know what the TableName is, as this is not a property of the WebGrid.  &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;How do I refresh the grid?&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'consolas', 'courier new'"&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Tue, 21 Sep 2010 00:58:58 GMT</pubDate><dc:creator>yudi</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;From your previous post, it seems that your original required scenario is to filter the child table of hierarchical WebGrid from code-behind.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;I made a simple sample of a test page of this specific scenario. In my test page, “Supplier” and “Products” table of Northwind database is bind to the WebGrid to create a hierarchical grid – where “Products" table is the child table. An ASP.NET button is then added to filter the child table based on the “Discontinued” field. It will filter the “Products” table where Discontinued field equals to “False”.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;I simply use following snippet code to implement this scenario.&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'consolas', 'courier new'; font-size: 9pt"&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;protected void&lt;/span&gt; Button1_Click(&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;object&lt;/span&gt; sender, &lt;span style="font-family: 'consolas', 'courier new'; color: #2b91af; font-size: 9pt"&gt;EventArgs&lt;/span&gt; e)
{
    &lt;span style="font-family: 'consolas', 'courier new'; color: #2b91af; font-size: 9pt"&gt;WebGridFilter&lt;/span&gt; ChildFilter = &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;new&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: #2b91af; font-size: 9pt"&gt;WebGridFilter&lt;/span&gt;();
    ChildFilter.ColumnMember = &lt;span style="font-family: 'consolas', 'courier new'; color: red; font-size: 9pt"&gt;"Discontinued"&lt;/span&gt;;
    ChildFilter.FilterText = &lt;span style="font-family: 'consolas', 'courier new'; color: red; font-size: 9pt"&gt;"False"&lt;/span&gt;;
    ChildFilter.FilterType = &lt;span style="font-family: 'consolas', 'courier new'; color: #2b91af; font-size: 9pt"&gt;ColumnFilterType&lt;/span&gt;.EqualTo;
    WebGrid1.RootTable.ChildTables.GetNamedItem(&lt;span style="font-family: 'consolas', 'courier new'; color: red; font-size: 9pt"&gt;"Products"&lt;/span&gt;).FilteredColumns.Add(ChildFilter);
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui', 'sans-serif'; color: #1f497d; font-size: 9pt"&gt;The test page is enclosed as an attachment. Please have the attached sample page tested on your end and let us know your response.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Fri, 17 Sep 2010 03:25:38 GMT</pubDate><dc:creator>danielerm78</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;I put your code inside the OnClick event,but the java script function is not invoked.&lt;/p&gt;
&lt;p&gt;But if I put your code inside the loadPage event for the message LoadChild the JavaScript&lt;/p&gt;
&lt;p&gt;function is invoked but the child is not refreshed yet.&lt;/p&gt;
&lt;p&gt;The only way ,I found to filter also the child, is to create a local filter by javascript:&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;var grid1 = ISGetObject("WebGrid1");&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;var grid1Child = grid1.Tables["TableName"];&lt;br /&gt; var newFilter = new WebGridFilter(); // create new Filter configuration&lt;br /&gt; newFilter.ColumnMember = "productnumber";&lt;br /&gt; newFilter.FilterType = "Like";&lt;br /&gt; newFilter.FilterText = document.getElementById('TextBox1').value;&lt;br /&gt;&lt;br /&gt; grid1Child.FilteredColumns.Add(newFilter);&lt;br /&gt; grid1Child.UpdateUI();&lt;br /&gt; grid1Child.Refresh();&lt;/p&gt;
&lt;p&gt;and call it in the event client click button.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;In this way I'm be able to flter also the child table.&lt;/p&gt;
&lt;p&gt;My problem now is that if I don't open at least one time the child grid &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I get a java script error on the function:&lt;/p&gt;
&lt;p&gt;grid1Child.UpdateUI();&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Is there a way to avoid this?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks a lot &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Daniele Barbini.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Thu, 16 Sep 2010 16:26:55 GMT</pubDate><dc:creator>yudi</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;In order to call the Javascript function from C# code in the OnButtonClick event you can use InvokeScript method.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;The snippet code below shows how to call refreshChild() Javascript function from C# OnButtonClick event.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="font-family: 'courier new'; color: blue; font-size: 9pt"&gt;protected void&lt;/span&gt; Button1_Click(&lt;span style="font-family: 'courier new'; color: blue; font-size: 9pt"&gt;object&lt;/span&gt; sender, &lt;span style="font-family: 'courier new'; color: #2b91af; font-size: 9pt"&gt;EventArgs&lt;/span&gt; e)
{
    WebGrid1.ClientAction.InvokeScript(&lt;span style="font-family: 'courier new'; color: #a31515; font-size: 9pt"&gt;"refreshChild();"&lt;/span&gt;);
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Thu, 16 Sep 2010 05:00:26 GMT</pubDate><dc:creator>danielerm78</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;Ok I start the filter by a button,&lt;/p&gt;&lt;p&gt;and on the c# code in the OnButtonClick event I call:&lt;/p&gt;
&lt;p&gt;MyWebgrid.DataBind();&lt;/p&gt;
&lt;p&gt;and the root table is refreshed in the right way but the child table no.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;So where I have to put the code to call the java script function &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;that you &lt;span class="short_text" id="result_box"&gt;&lt;span title="" style=""&gt;suggested me.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;Daniele&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Tue, 14 Sep 2010 18:10:35 GMT</pubDate><dc:creator>yudi</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;You can try to use following code in order to refresh WebGrid child tables only.&lt;/span&gt;&lt;/p&gt;
&lt;ol style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;&lt;li&gt;Add a function in &lt;strong&gt;client side&lt;/strong&gt;.&lt;/li&gt;&lt;li&gt;Refresh the &lt;strong&gt;child table&lt;/strong&gt; using &lt;strong&gt;refresh method&lt;/strong&gt;&lt;pre&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;function&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: black; font-size: 9pt"&gt;refreshChild() {&lt;/span&gt;
    &lt;span style="font-family: 'consolas', 'courier new'; color: blue; font-size: 9pt"&gt;var&lt;/span&gt; &lt;span style="font-family: 'consolas', 'courier new'; color: black; font-size: 9pt"&gt;grid = ISGetObject(&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: #a31515; font-size: 9pt"&gt;"WebGrid1"&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: black; font-size: 9pt"&gt;);
    grid.Tables[&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: #a31515; font-size: 9pt"&gt;"Orders"&lt;/span&gt;&lt;span style="font-family: 'consolas', 'courier new'; color: black; font-size: 9pt"&gt;].Refresh();
}&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;run the project&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Hierarchical Grid,  how to refresh the data of the child table?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-Grid-how-to-refresh-the-data-of-the-child-table/</link><pubDate>Tue, 14 Sep 2010 08:29:46 GMT</pubDate><dc:creator>danielerm78</dc:creator><category>Hierarchical Grid</category><category>Hier</category><description>Hi,
&lt;p&gt;I have an Hierarchical Grid with one Child table.&lt;/p&gt;
&lt;p&gt;The rootTable has a DataMember filled by a storedProcedure and I use for this Datasource&lt;/p&gt;
&lt;p&gt;a FilterExpression attribute and a FilterParameters tag:&lt;/p&gt;
&lt;p&gt;&amp;lt;FilterParameters&amp;gt;&lt;br /&gt; &amp;lt;asp:ControlParameter PropertyName="Text" Name="invoicenumber" ControlID="TextBox1"&amp;gt;&amp;lt;/asp:ControlParameter&amp;gt;&lt;br /&gt; &amp;lt;/FilterParameters&amp;gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The child Table has a DataMember filled by a storedProcedure which has as input parameter&lt;/p&gt;
&lt;p&gt;a ControlParameter:&lt;/p&gt;
&lt;p&gt;&amp;lt;asp:ControlParameter ControlID="TextBox2" ConvertEmptyStringToNull="True" &lt;br /&gt; DefaultValue="" Name="productnumber" PropertyName="Text" Type="String" /&amp;gt;&lt;/p&gt;
&lt;p&gt;So the stored procedure use this parameter to make the query.&lt;/p&gt;
&lt;p&gt;I added a button on my application and inside the Button event I put this code to refresh the data:&lt;/p&gt;
&lt;p&gt;WebGrid1.DataBind();&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;So the data of the root table is refreshed but the data of the child table no.&lt;/p&gt;
&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;The same thing if I &lt;span class="short_text" id="result_box"&gt;&lt;span title="" style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);"&gt;remove the &lt;/span&gt;&lt;/span&gt;ControlParameter for the DataMember used for the childTable&lt;/p&gt;
&lt;p&gt;and use I FilterExpression attribute and a FilterParameters tag.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;So how to refresh the also data of the ChildGrid for a Hierarchical Grid?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advanced.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Daniele Barbini&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>