Skip to content

Replies

0
Jesus
Jesus answered on Dec 2, 2011 4:13 PM

Hello Petar, thanks for your reply. Let me explain you how Im populating the WHDG:

First, I use IList<myEntity>
I retrieve data from my database and store it in my generic List. One of the properties of this entity is a another IList where Im storing the detail information for each record. For example:

IList<Parent>
IDParent,Name,Address,IList<Children>

IList<Children>
IDChild,IDParent,Name,Age

I set up the columns and bands by using the wizard of the WHDG (not in code behind as the example you provided me shows). The I program a method to fill the WHDG like this:

IList<Parent> varListHeader = methodToRetrieveAllDataFromDB()
nameWHDG.DataSource = varListHeader
nameWHDG.DataBind()

In the aspx I have this for the WebHierarchicalDataGrid:

  <ig:WebHierarchicalDataGrid ID="dgLista" runat="server"
        AutoGenerateColumns="False" DataKeyFields="IDParent" Height="350px"
        Width="836px">
        <Columns>
       ……………..

I set up the DataKeyFields with the IDParent and in the Band I have something like this

<Bands>
            <ig:Band AutoGenerateColumns="False" DataMember="varListHeader"
                Key="varListHeader" DataKeyFields="IDParent">
                <Columns>
                    <ig:BoundDataField DataFieldName="IDChild" Key="IDChild">
                        <Header Text="Id of the Child" />
                    </ig:BoundDataField> 
                   ……………..
Do I have to do anything in the postback event?

Thanks in advance.
Jesus

0
Jesus
Jesus answered on Dec 1, 2011 9:09 PM

Hi Petar, Im having a problem with a WebHierarchicalDataGrid. When I populate the control without setting the columns, it works fine, but when I stablish wich columns my grid and its childs grids are going to show, there is my problem. It shows the grid but when I click the CollapseButton, it doesn't do anything. I've already set the DataFieldKeys (in both cases the same) but still. Is there anything else I have to do when I set the columns?

Thanks for your time
Jesus