如何在Radgrid中展开的Hierarchy中获取扩展的行列值

时间:2013-05-03 12:02:45

标签: c# javascript telerik radgrid

我有一个如下的radgrid:

 <telerik:RadGrid ID="ProductRanges_Grd" ShowHeaderWhenEmpty="true" runat="server"
                        AutoGenerateColumns="false" Width="100%" Height="250px" ShowHeader="true" Visible="false"
                         OnDetailTableDataBind="ProductRanges_Grd_DetailTableDataBind" OnItemCommand="ProductRanges_Grd_ItemCommand"
                          OnInsertCommand="ProductRanges_Grd_InsertCommand" OnUpdateCommand="ProductRanges_Grd_UpdateCommand" 
                          OnNeedDataSource="ProductRanges_Grd_NeedDataSource" OnDeleteCommand="ProductRanges_Grd_DeleteCommand"
                          OnItemDataBound="ProductRanges_Grd_ItemDataBound"  >
                        <ClientSettings>
                        <ClientEvents OnRowSelected="RowSelected"  OnHierarchyExpanded="HierarchyExpanded" />
                            <Scrolling AllowScroll="true" />
                            <Selecting AllowRowSelect="true"  />
                        </ClientSettings>
                        <MasterTableView EditMode="EditForms" HierarchyLoadMode="Client" DataKeyNames="PROVIDER_ID,PROVIDER_NAME" 
                            HierarchyDefaultExpanded="false">
                            <NoRecordsTemplate>
                                <span></span>
                            </NoRecordsTemplate>
                            <Columns>
                                <telerik:GridBoundColumn UniqueName="PROVIDER_ID" DataField="PROVIDER_ID" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn UniqueName="PROVIDER_NAME" DataField="PROVIDER_NAME" HeaderText="Provider">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <DetailTables>
                                <telerik:GridTableView CommandItemDisplay="Top" DataKeyNames="PRODUCT_ID" Name="ProductTableView"
                                    ShowHeadersWhenNoRecords="true" EditMode="EditForms" ShowFooter="true" >

                                    <CommandItemTemplate>
                                        <table width="100%">
                                            <tr>
                                                <td align="left" style="padding-left: 8px;" valign="middle">
                                                    <asp:ImageButton ID="AddDetailTable_btn" CommandName="InitInsert"  runat="server"
                                                        ImageUrl="~/images/add.gif" />&nbsp; Add
                                                </td>
                                            </tr>
                                        </table>
                                    </CommandItemTemplate>
                                    <Columns>
                                        <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="../../../images/Erase12.png"
                                            HeaderText="Remove" CommandName="Delete">
                                        </telerik:GridButtonColumn>
                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../../../images/edit.gif">
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridBoundColumn UniqueName="ROW_ID" DataField="ROW_ID" Display="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="PRODUCT_ID" DataField="PRODUCT_ID" Display="false">
                                        </telerik:GridBoundColumn>

                                        <telerik:GridBoundColumn UniqueName="PRODUCT_NAME" DataField="PRODUCT_NAME" HeaderText="Products">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Min_Quantity" DataField="MIN_QUANTITY" HeaderText="Minimum quantity">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Max_Quantity" DataField="MAX_QUANTITY" HeaderText="Maximum quantity">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn UniqueName="Comission" DataField="DISCOUNT_VALUE"
                                            HeaderText="Comission">
                                        </telerik:GridBoundColumn>

                                
                                                     

   <script type="text/javascript">

   function HierarchyExpanded(sender,args)
  {
     // how can i get the expended row ProviderID in here 
  }

任何帮助apriciated

1 个答案:

答案 0 :(得分:0)

请尝试使用以下代码段。

JS

function HierarchyExpanded(sender, args) {
            alert(args.get_gridDataItem().getDataKeyValue("PROVIDER_ID"));
        }

的.aspx

<MasterTableView ClientDataKeyNames="PROVIDER_ID" HierarchyLoadMode="Client">