Hierachical rad grid with two DataKeyNames

2 posts, 0 answers
  1. lakmal
    lakmal avatar
    76 posts
    Member since:
    Jun 2009

    Posted 11 Oct 2009 Link to this post

    HI,

    I have grid inside the grid. I want display at sub grid according to the two data DataKeyNames. I have put like below but its not working

    <telerik:RadGrid ID="radInterfacer" runat="server" AutoGenerateColumns="False" DataSourceID="lnkInterfacer"
                GridLines="None">
                <MasterTableView DataSourceID="lnkInterfacer" DataKeyNames="DocNo,ICompanyCode" >

                        <DetailTables>
                        <telerik:GridTableView DataKeyNames="DocNo,ICompanyCode" DataSourceID="lnkInterfaceTrans" Width="100%"
                            runat="server">
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="DocNo,ICompanyCode" MasterKeyField="DocNo,ICompanyCode" />
                            </ParentTableRelation>
                            
                             <Columns>
                                      
                                            <telerik:GridBoundColumn DataField="IReasonForIssueDesc" HeaderText="Reason for Issue"
                                                UniqueName="IReasonForIssueDesc">
                                            </telerik:GridBoundColumn>
                                            
                                            
                                             <telerik:GridBoundColumn DataField="IfaceDocRev" HeaderText="IfaceDocRev"
                                                UniqueName="IfaceDocRev">
                                            </telerik:GridBoundColumn>
                                            
                                            
                                            <telerik:GridBoundColumn DataField="IfaceTransDate" HeaderText="Interfacer Trans Date"   DataFormatString="{0:dd-MM-yyyy}"
                                                UniqueName="IfaceTransDate">
                                            </telerik:GridBoundColumn>         
                                            
                                            <telerik:GridBoundColumn DataField="IfaceTransNo" HeaderText="Iface Trans No"   
                                                UniqueName="IfaceTransNo">
                                            </telerik:GridBoundColumn>  
                                                                                                                   
                                            
                                              <telerik:GridBoundColumn DataField="IOurDocRev" HeaderText="Interfacer our Doc Rev"
                                                UniqueName="IOurDocRev">
                                            </telerik:GridBoundColumn>
                                            
                                            
                                              <telerik:GridBoundColumn DataField="IOurTransRetDate" HeaderText="Interfacer Trans Ret Date"  DataFormatString="{0:dd-MM-yyyy}"
                                                UniqueName="IOurTransRetDate">
                                            </telerik:GridBoundColumn>
                                           
                                            
                                             <telerik:GridBoundColumn DataField="IOurRtrnTransNo" HeaderText="Interfacer Rtrn Trans No"
                                                UniqueName="IOurRtrnTransNo">
                                            </telerik:GridBoundColumn>
                                            
                                             <telerik:GridBoundColumn DataField="OurRtrnCodeID" HeaderText="Our Rtrn Code"
                                                UniqueName="OurRtrnCodeID">
                                            </telerik:GridBoundColumn>
                                            
                                      
                                        </Columns>
                            
                         </telerik:GridTableView>
                        </DetailTables>
                         
    <RowIndicatorColumn>
    <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>

    <ExpandCollapseColumn>
    <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="DocNo" HeaderText="DocNo"
                UniqueName="DocNo">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="InterfacerDocNo"
                HeaderText="InterfacerDocNo" UniqueName="InterfacerDocNo">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ICompanyName" HeaderText="ICompanyName"
                UniqueName="ICompanyName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ICompanyCode" HeaderText="ICompanyCode"
                UniqueName="ICompanyCode">
            </telerik:GridBoundColumn>
        </Columns>
        
        
    </MasterTableView>
            </telerik:RadGrid>
            
             <asp:LinqDataSource ID="lnkInterfacer" runat="server" ContextTypeName="DataClassesDataContext"
                                            TableName="qry_Data_InterfacerDocs"
                                    AutoPage="False" >
                                                  
                                    </asp:LinqDataSource>
                    
                    
                        <asp:LinqDataSource ID="lnkInterfaceTrans" runat="server" ContextTypeName="DataClassesDataContext"
                                            TableName="qry_DATA_InterfacerTransmittals"
                                    AutoPage="False"
                Where="DocNo == @DocNo &amp;&amp; ICompanyCode == @ICompanyCode" >
                  <WhereParameters>                                             
                  <asp:SessionParameter Name="DocNo" SessionField="DocNo" Type="string" />                                               
                      <asp:SessionParameter Name="ICompanyCode" SessionField="ICompanyCode"
                          Type="String" />
                  </WhereParameters>
                  </asp:LinqDataSource>

    where is the error?





     
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 14 Oct 2009 Link to this post

    Hello,

    If multiple fields are needed for linking to child tables, you can list them in the ASPX file, separating their names with commas (but no spaces). Please find more information in the following help article:
    Hierarchical data-binding using declarative relations (DataKeyNames)

    All the best,
    Pavlina
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top