Question

i have a radgrid as follow :

 <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 
  }

any help apriciated

Was it helpful?

Solution

Please try with the below code snippet.

JS

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

.aspx

<MasterTableView ClientDataKeyNames="PROVIDER_ID" HierarchyLoadMode="Client">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top