Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
530
Help with Databind from generic list
posted

Hi,

I have a hierarchical grid which is bound dynamically to a List<Utility> object list. The Utility object has a property List<UtilityRateDetail> UtilityRateDetailList So, I am trying to do a parent-child binding. I have the markup set up as follows:

<igtblh:WebHierarchicalDataGrid ID="gvUtilityDetail" runat="server" AutoGenerateColumns="False"
    DataKeyFields="ID" Height="350px" Width="100%" Font-Size="10pt">
    <ExpandCollapseAnimation SlideOpenDirection="Auto" SlideOpenDuration="300" SlideCloseDirection="Auto"
        SlideCloseDuration="300" />
    <ExpandButton ImageUrl="../../Images/Grid/Expand.gif"  AltText="+"></ExpandButton>
    <CollapseButton ImageUrl="../../Images/Grid/Collapse.gif" AltText="-">
    </CollapseButton>
    <Columns>
        <igtblh:BoundDataField DataFieldName="AccountNumber" Key="AccountNumber">
            <Header Text="Account #" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="Interval" Key="Interval">
            <Header Text="Interval" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="RateCode" Key="RateCode">
            <Header Text="Rate Code" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="ChargeType" Key="ChargeType">
            <Header Text="Charge Type" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="PreviousReadingDate" Key="PreviousReadingDate"
            DataFormatString="{0:d}" DataType="System.DateTime">
            <Header Text="Previous Reading" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="ReadingDate" Key="ReadingDate" DataFormatString="{0:d}"
            DataType="System.DateTime">
            <Header Text="Current Reading" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="UnitConsumption" Key="UnitConsumption" DataType="System.Double">
            <Header Text="Unit Consumption" />
        </igtblh:BoundDataField>
        <igtblh:BoundDataField DataFieldName="InvoiceCost" Key="InvoiceCost" DataFormatString="{0:c}"
            DataType="System.Decimal">
            <Header Text="Invoice Cost" />
        </igtblh:BoundDataField>
    </Columns>
    <Bands>
        <igtblh:Band Key="UtilityRateDetailList" AutoGenerateColumns="False" DataKeyFields="GuidUtilityRateDetail"
            DataMember="UtilityRateDetailList">          
            <Columns>
                <igtblh:BoundDataField Key="GuidUtilityRateDetail" DataFieldName="GuidUtilityRateDetail"
                    Hidden="true">
                    <Header Text="ID" />
                </igtblh:BoundDataField>
                <igtblh:BoundDataField DataFieldName="Parent" Key="Parent">
                    <Header Text="UtilityDetail" />
                </igtblh:BoundDataField>
                <igtblh:BoundDataField DataFieldName="RateName" Key="RateName">
                    <Header Text="Rate Name" />
                </igtblh:BoundDataField>
                <igtblh:BoundDataField DataFieldName="UnitCost" Key="UnitCost" DataFormatString="{0:c}"
                    DataType="System.Decimal">
                    <Header Text="Unit Cost" />
                </igtblh:BoundDataField>
                <igtblh:BoundDataField DataFieldName="LSCost" Key="LSCost" DataFormatString="{0:c}"
                    DataType="System.Decimal">
                    <Header Text="L.S. Cost" />
                </igtblh:BoundDataField>
            </Columns>
        </igtblh:Band>
    </Bands>   
</igtblh:WebHierarchicalDataGrid>

In my page load, I do this:

UtilityDetailList = UtilityDetailPresenter.GetAll().ToList();

gvUtilityDetail.DataSource = UtilityDetailList;

gvUtilityDetail.DataBind();

When I fire up the page, I don't see an expand button. Am I missing something? I have the images as well and I am not sure what I am missing.