2015-04-28 148 views
0

我使用的是Asp.net C#Telerik NestedGrid。當我按第一行展開時,我得到了正確的結果,但當我按第二行時,由於某種原因,我得到了第一行的結果,我無法獲得新值。 我在做什麼錯了,我該如何解決它?
我需要製作類似於:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)嵌套RadGrid錯誤結果

在ASPX

<telerik:RadGrid ID="RadGrid1" runat="server" GroupPanelPosition="Top" Skin="Outlook" Visible="False" AllowPaging="True" > 
    <MasterTableView AutoGenerateColumns="False" ClientDataKeyNames="DocHandle" PageSize="20" > 
     <Columns> 
       <telerik:GridBoundColumn DataField="DocDescr" HeaderText="DocDescr" ReadOnly="True" SortExpression="DocDescr"/> 
       <telerik:GridBoundColumn DataField="DocHandle" HeaderText="DocHandle" ReadOnly="True" SortExpression="DocHandle" /> 
       <telerik:GridBoundColumn DataField="CreationDate" HeaderText="CreationDate" ReadOnly="True" SortExpression="CreationDate" DataFormatString="{0:yyyy-MM-dd}" /> 
     </Columns> 
     <NestedViewSettings DataSourceID="SqlDataSource1"> 
     <ParentTableRelation> 
     <telerik:GridRelationFields DetailKeyField="DocHandle" MasterKeyField="DocHandle" /> 
     </ParentTableRelation> 
     </NestedViewSettings> 
     <NestedViewTemplate> 
      <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap"> 
     <div class="contactWrap"> 
      <fieldset style="padding: 10px;"> 
      <legend style="padding: 5px;"><b>Detail info for Document: <%#Eval("DocHandle") %></b> 
      </legend> 
      <table> 
       <tr> 
       <td> 
       Document Description: 
       </td> 
       <td> 
        <asp:Label ID="titleLabel" Text='<%#Bind("DocDescr") %>' runat="server"></asp:Label> 
       </td> 
        </tr> 
       <tr> 
       <td> 
       Creation Date: 
       </td> 
       <td> 
        <asp:Label ID="ownerLabel" Text='<%#Bind("CreationDate", "{0:yyyy-MM-dd}") %>' runat="server" ></asp:Label> 
       </td> 
        </tr> 
       <tr> 
       <td> 
       Created By: 
       </td> 
       <td> 
        <asp:Label ID="createdbyLabel" Text='<%#Bind("CreatedBy") %>' runat="server"></asp:Label> 
       </td> 
        </tr> 
       </table> 
       </fieldset> 
      </div> 
       </asp:Panel> 
        </NestedViewTemplate> 
     </MasterTableView> 
    </telerik:RadGrid> 

回答

0

刪除以下

>  <NestedViewSettings DataSourceID="SqlDataSource1"> 
>    <ParentTableRelation> 
>    <telerik:GridRelationFields DetailKeyField="DocHandle" MasterKeyField="DocHandle" /> 
>   </ParentTableRelation> 
</NestedViewSettings> 
從您的代碼

,它應該沒問題。