This is a migrated thread and some comments may be shown as answers.

Problem viewing nested table

2 Answers 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
bill
Top achievements
Rank 1
bill asked on 07 Nov 2008, 07:56 PM
Using the Telerik example, I tried to get the grid to show Master / Detail data.  The master data binds fine, but the detail data doesn't show up at all.
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager runat="server" OutputCompression="AutoDetect">  
    </telerik:RadScriptManager> 
    <div> 
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px"   
            Width="100%">  
 
    <asp:Button ID="ParseButton" runat="server" Text="Parse" /><br /> 
        <asp:TextBox ID="AcknowledgementTextBox" runat="server" Height="166px"   
            TextMode="MultiLine" Width="100%"></asp:TextBox> 
          
        <telerik:RadGrid ID="OutputGrid" runat="server" Skin="Web20" AutoGenerateColumns="false" AllowMultiRowSelection="false" GridLines="None">  
            <MasterTableView DataKeyNames="SegmentOrdinal" DataMember="Ak3">  
               <DetailTables> 
                    <telerik:GridTableView DataKeyNames="ElementOrdinal" DataMember="Ak4" Width="100%" runat="server" > 
                        <ParentTableRelation> 
                            <telerik:GridRelationFields DetailKeyField="SegmentOrdinal"   
                            MasterKeyField="SegmentOrdinal" /> 
                        </ParentTableRelation> 
                    <Columns> 
                        <telerik:GridBoundColumn DataField="ElementPosition" HeaderText="Element Position" UniqueName="ElementPosition" /> 
                        <telerik:GridBoundColumn DataField="ElementReferenceNumber" HeaderText="Element Reference Number" UniqueName="ElementReferenceNumber" /> 
                        <telerik:GridBoundColumn DataField="ElementErrorCode" HeaderText="Element Error Code" UniqueName="ElementErrorCode" /> 
                        <telerik:GridBoundColumn DataField="BadData" HeaderText="Bad Data" UniqueName="BadData" /> 
 
                    </Columns> 
                    </telerik:GridTableView> 
               </DetailTables> 
               <Columns> 
                    <telerik:GridBoundColumn DataField="SegmentIdCode" HeaderText="Segment ID Code" UniqueName="SegmentIdCode" /> 
                    <telerik:GridBoundColumn DataField="SegmentPosition" HeaderText="Segment Position" UniqueName="SegmentPosition" /> 
                    <telerik:GridBoundColumn DataField="LoopIdCode" HeaderText="Loop ID Code" UniqueName="LoopIdCode" /> 
                    <telerik:GridBoundColumn DataField="SegmentErrorCode" HeaderText="Segment Error Code" UniqueName="SegmentErrorCode" /> 
               </Columns> 
               </MasterTableView> 
        </telerik:RadGrid> 
        <asp:Label ID="ErrorLabel" runat="server" ForeColor="Red"></asp:Label> 
            </telerik:RadAjaxPanel> 
    </div> 
      
    <telerik:RadAjaxManager runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="OutputGrid" /> 
                    <telerik:AjaxUpdatedControl ControlID="ErrorLabel" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
              </AjaxSettings> 
    </telerik:RadAjaxManager> 
    </form> 
</body> 
    Protected Sub ParseButton_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles ParseButton.Click  
        Try 
            ErrorLabel.Text = "" 
            'Dim interchange As New AnsiClient.InterchangeControl(AcknowledgementTextBox.Text)  
            'AcknowledgementTextBox.Text = interchange.ToString.Replace(interchange.Delimiters.SegmentDelimeter, interchange.Delimiters.SegmentDelimeter & Environment.NewLine)  
            'Dim ack = DirectCast(interchange.FunctionalGroups(0).Transactions(0), Acknowledgment)  
            'ParseAcknowledgement(ack)  
            Dim ds As New System.Data.DataSet  
            ds.ReadXml("C:\test.xml")  
            OutputGrid.DataSource = ds  
            OutputGrid.DataBind()  
        Catch ex As Exception  
            ErrorLabel.Text = ex.ToString  
        End Try 
    End Sub 
The data in "C:\test.xml"
<?xml version="1.0" standalone="yes"?>  
<Data xmlns="http://tempuri.org/Data.xsd">  
  <Ak3> 
    <SegmentIdCode>EB</SegmentIdCode> 
    <SegmentPosition>40</SegmentPosition> 
    <LoopIdCode>2110C</LoopIdCode> 
    <SegmentErrorCode>SegmentHasDataElementErrors</SegmentErrorCode> 
    <SegmentOrdinal>1</SegmentOrdinal> 
  </Ak3> 
  <Ak3> 
    <SegmentIdCode>EB</SegmentIdCode> 
    <SegmentPosition>42</SegmentPosition> 
    <LoopIdCode>2110C</LoopIdCode> 
    <SegmentErrorCode>SegmentHasDataElementErrors</SegmentErrorCode> 
    <SegmentOrdinal>2</SegmentOrdinal> 
  </Ak3> 
  <Ak4> 
    <ElementPosition>9</ElementPosition> 
    <ElementReferenceNumber>673</ElementReferenceNumber> 
    <ElementErrorCode>ConditionalRequiredDataElementMissing</ElementErrorCode> 
    <BadData>VS</BadData> 
    <SegmentOrdinal>1</SegmentOrdinal> 
    <ElementOrdinal>1</ElementOrdinal> 
  </Ak4> 
  <Ak4> 
    <ElementPosition>9</ElementPosition> 
    <ElementReferenceNumber>673</ElementReferenceNumber> 
    <ElementErrorCode>ConditionalRequiredDataElementMissing</ElementErrorCode> 
    <BadData>VS</BadData> 
    <SegmentOrdinal>2</SegmentOrdinal> 
    <ElementOrdinal>2</ElementOrdinal> 
  </Ak4> 
</Data> 

Any help is always appreciated, thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 10 Nov 2008, 07:38 AM
Hello bill,

Your grid is bound on post-back event (button click) and nothing rebinds the grid on subsequent post-back. Please check these examples for more info:
http://demos.telerik.com/aspnet/Prometheus/Grid/Examples/Hierarchy/DeclarativeRelations/DefaultCS.aspx
http://demos.telerik.com/aspnet/Prometheus/Grid/Examples/Programming/DetailTableDataBind/DefaultCS.aspx

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
bill
Top achievements
Rank 1
answered on 10 Nov 2008, 03:34 PM
The example showing how to handle the DetailTableDataBind event helped me solve my problem.  Thank you for pointing it out.
Tags
Grid
Asked by
bill
Top achievements
Rank 1
Answers by
Vlad
Telerik team
bill
Top achievements
Rank 1
Share this question
or