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
733
Can't access child band columns in codebehind
posted

I have my columns for the parent and child tables declared in code.  I load the data and bind at runtime.  However I cannot access anything but the parent band.  Here is the xaml.  In this case gridTransaction.ColumnLayouts(1) or gridTransaction.ColumnLayouts("TransactionCodings") is nothing at runtime.

       <igGrid:XamWebGrid HorizontalAlignment="Left" Margin="0,85,0,0" Name="gridTransaction" VerticalAlignment="Top" AutoGenerateColumns="False">
            <igGrid:XamWebGrid.Columns>
                <igGrid:TextColumn Key="TransactionDate" HeaderText="Trans Date" FormatString="{}{0:d}" HorizontalContentAlignment="Right" />
                <igGrid:UnboundColumn Key="Merchant" ValueConverter="{StaticResource TransactionMerchant}"/>
                <igGrid:TextColumn Key="MCCNum" HeaderText="Category"/>
                <igGrid:TextColumn Key="PostDate" HeaderText="Post Date" FormatString="{}{0:d}" HorizontalContentAlignment="Right"/>
                <igGrid:TextColumn Key="TotalDue" HeaderText="Total Due" FormatString="{}{0:c}" HorizontalContentAlignment="Right"/>
                <igGrid:TextColumn Key="Status" ValueConverter="{StaticResource TransactionStatus}" HeaderText="Status"/>
                <igGrid:ColumnLayout Key="TransactionCodings">
                    <igGrid:ColumnLayout.Columns>
                        <igGrid:TextColumn Key="CodingType" HeaderText="Code To" />
                        <igGrid:TextColumn Key="Company" />
                        <igGrid:TextColumn Key="JobNum" HeaderText="Job"/>
                        <igGrid:TextColumn Key="JobPhase" HeaderText="Phase" />
                        <igGrid:TextColumn Key="JobCostType" HeaderText="Cost Type" />
                        <igGrid:TextColumn Key="EquipmentNum" HeaderText="Equipment" />
                        <igGrid:TextColumn Key="CostCategory" HeaderText="Category" />
                        <igGrid:TextColumn Key="GLAccount" HeaderText="Account" />
                        <igGrid:UnboundColumn Key="Description" />
                        <igGrid:TextColumn Key="Amount" FormatString="{}{0:c}" HorizontalContentAlignment="Right" />
                    </igGrid:ColumnLayout.Columns>
                </igGrid:ColumnLayout>
            </igGrid:XamWebGrid.Columns>
        </igGrid:XamWebGrid>

  • 40030
    Verified Answer
    Offline posted

    Hi, 

    When are you accessing them?

    A ColumnLayout isn't added to the ColumnLayouts collection until the data is being loaded.

    However, you can access it through the Columns collection:

    ColumnLayout layout = grid.Columns.ColumnLayouts["TransactionCodings"]; 

    Hope this helps, 

    -SteveZ