﻿<?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 writing to/from dataset, with dropdown column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-grid-writing-tofrom-dataset-with-dropdown-column/</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 writing to/from dataset, with dropdown column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-grid-writing-tofrom-dataset-with-dropdown-column/</link><pubDate>Wed, 10 Oct 2012 00:36:26 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><category>hierarchy grids</category><description>&lt;blockquote&gt;&lt;p&gt;Ideally, this is what I want: Initially, all the rows in Table 1 should be displayed, with the UnitTypeDescription in an editable combobox in each row, so that the UnitTypeID in Table 1 will be updated if I change the combobox values. The other columns should not be editable.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;In order to show UnitTypeDescription – instead of UnitTypeID – in an editable combobox in each row, you can try the use the WebValueList feature of WebGrid. The WebValueList is designed to allow different data to be displayed instead of default cell’s text or value.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;This feature is widely used in WebGrid samples. There are numerous sample of WebGrid which uses this: BindWebValueListtoISDataSource.aspx; ColumnsortingwithWebValueList.aspx; DeclarativeWebValueListBinding.aspx; MultipleValuesinWebValueList.aspx.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Below is the snippet code which shows how to declare WebValueList on a WebGrid which is bound to ISDataSource control.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;ISWebGrid:WebGrid ID="WebGrid1" runat="server" ...&amp;gt;
    &amp;lt;RootTable DataKeyField="ProductID" Caption="Products" DataMember="Products"&amp;gt;
        &amp;lt;Columns&amp;gt;
            ...
            &amp;lt;ISWebGrid:WebGridColumn Caption="CategoryID" DataMember="CategoryID"
                DataType="System.Int32" EditType="WebComboNET" Name="CategoryID"
                WebComboID="wcCategories" Width="150px"&amp;gt;
                &amp;lt;ValueList DataMember="Categories" DataTextField="CategoryName"
                    DataValueField="CategoryID"&amp;gt;
                &amp;lt;/ValueList&amp;gt;
            &amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
        &amp;lt;/Columns&amp;gt;
    &amp;lt;/RootTable&amp;gt;
    &amp;lt;LayoutSettings AllowEdit="Yes" AllowFilter="Yes"&amp;gt;
    &amp;lt;/LayoutSettings&amp;gt;
&amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;In the snippet code, the ValueList is implemented at column [CategoryID] and column [SupplierID]. When the grid is displayed in browser, CategoryID and SupplierID in each row is translated to CategoryName and CompanyName respectively.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Last, we can utilize WebCombo control as the edit type of the UnitTypeDescription. This will make the option of ValueList displayed in a combobox control as shown in the following screenshot (taken from WebComboNETasFilterEditType.aspx sample file of WebGrid).&lt;/span&gt;&lt;/p&gt;&lt;img width="450" height="300" alt="" src="http://www.intersoftpt.com/Community/Attachments/3412/WebGrid_WebValueListInWebCombo.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;If I expand a row, it should show the child rows with the same column definitions, so that all the columns line up (so the UnitID column for parents and children will be visually lined up, etc). If a row does not have any child rows, it should not display a box to expand that row.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Please allow me to introduce you to the SelfReference table mode. SelfReference table mode enables you to display self-referencing hierarchy table quickly by setting the configuration in SelfReferenceSettings, attached per table. There are numerous UI settings that applicable to this feature –including your specific scenario – such as treeview selection mode, parent root mode, autofit column on expand, and more.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;You can bind data usually at it is a normal flat table; the grid will be able to automatically group the child rows based on the SelfReferenceSettings. You can use the SelfReferencingGrid.aspx sample file of WebGrid for your reference.&lt;/span&gt;&lt;/p&gt;&lt;img width="450px" height="300px" alt="" src="http://www.intersoftpt.com/Community/Attachments/3412/WebGrid_SelfReferencing.png" /&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Please feel free to let us know whether the self-reference approach suits your scenario best.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Hierarchical grid writing to/from dataset, with dropdown column</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Hierarchical-grid-writing-tofrom-dataset-with-dropdown-column/</link><pubDate>Tue, 09 Oct 2012 17:56:15 GMT</pubDate><dc:creator>pkeeler</dc:creator><category>WebGrid</category><category>hierarchy grids</category><description>&lt;p&gt;I'm evaluating WebGrid for our use, and I'm trying to figure out if it can handle this use case. Can someone help?&lt;/p&gt;
&lt;p&gt;Simplified situation:&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I have a DataSet, which I have pre-populated, with at least three tables. Table 0 contains three value/text pairs that I want to use for a dropdown, in the form UnitTypeID/UnitTypeDescription. Table 1 contains four columns: UnitID, ParentUnitID, UnitDescription, and UnitTypeID. Table 2 has the same structure as Table 1, with a relationship between ParentUnitID in table 2 and UnitID in Table 1. I could potentially then have Table 3 and beyond, where ParentUnitID for table n links to UnitID in table n-1.&lt;/p&gt;
&lt;p&gt;Ideally, this is what I want: Initially, all the rows in Table 1 should be displayed, with the UnitTypeDescription in an editable combobox in each row, so that the UnitTypeID in Table 1 will be updated if I change the combobox values. The other columns should not be editable. If I expand a row, it should show the child rows with the same column definitions, so that all the columns line up (so the UnitID column for parents and children will be visually lined up, etc). If a row does not have any child rows, it should not display a box to expand that row. Then when the user hits a 'Save' button elsewhere on the page, I need to update that dataset with the user's selections, and then the user can continue making edits.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;If it is not possible to get the columns to line up, then I can live without that. But I need to have the dropdowns, programmatic hierarchy, and postback. None of the tutorial examples quite matches what I'm trying to do. Can someone show me a simple example of how I could do this?&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>