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

Need to open a DetailTable during a Row Double Click

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
TAD RHODES
Top achievements
Rank 1
TAD RHODES asked on 05 Aug 2010, 11:33 PM
My requirement is to open a Detail Table in a Hierachy RadGrid from a double click.  We have the expand arrow working fine for this, but would also like to have Row Double click do the same thing. 

Here is sample of what we currently have:

Designer:

<telerik:RadGrid ID="rgvOrderHistory"
                 runat="server"
                 AllowPaging="True"
                 AllowCustomPaging="true"
                 AllowSorting="true"
                 AutoGenerateColumns="false"
                 AllowFilteringByColumn="false"
                 OnSortCommand="rgvOrderHistory_SortCommand"
                 OnNeedDataSource="rgvOrderHistory_NeedDataSource"
                 OnItemDataBound="rgvOrderHistory_ItemDataBound"
                 OnDetailTableDataBind="rgvOrderHistory_DetailTableDataBind"
                 CssClass="rgvOrderHistory"
            onitemcommand="rgvOrderHistory_ItemCommand" >
    <MasterTableView DataKeyNames="OrderNumber"
                     AllowPaging="true"
                     PageSize="10"
                     PagerStyle-AlwaysVisible="true"
                     PagerStyle-Mode="NextPrevAndNumeric"
                     AutoGenerateColumns="false"
                     AllowFilteringByColumn="false"
                     Name="OrderHistoryMaster">                              
            <Columns>
                 //SOME BOUND COLUMNS
   </Columns>
                
                     <DetailTables>
                        <telerik:GridTableView AutoGenerateColumns="false"
                                               AllowPaging="false"
                                               AllowFilteringByColumn="false"
                                               CssClass="rgvOrderHistoryDetails"
                                               Name="OrderHistoryDetail"
                                               DataKeyNames="ProductID" >
                       <Columns>
                            //SOME BOUND COLUMNS
  </Columns>
</MasterTableView>
   <ClientSettings></ClientSettings>
</telerik:RadGrid>

Code Behind:

   protected void rgvOrderHistory_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            try
            {

                if (e.IsFromDetailTable) return;

                int virtualItemCount;
                rgvOrderHistory.DataSource = GetOrderHistoryDataSource(out virtualItemCount);
                rgvOrderHistory.VirtualItemCount = virtualItemCount;
            }         
            catch (Exception ex)
            {
                //some code
            }
        }

  protected void rgvOrderHistory_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
        {
            try
            {

                GridDataItem dataItem = e.DetailTableView.ParentItem;
                int orderNumber = (int) dataItem.GetDataKeyValue("OrderNumber");
                int virtualItemCount;

                e.DetailTableView.DataSource = GetOrderHistoryDetailDataSource(orderNumber, e.DetailTableView.PageSize,
                                                                               e.DetailTableView.CurrentPageIndex,
                                                                               out virtualItemCount);
                e.DetailTableView.VirtualItemCount = virtualItemCount;

            }
            catch (Exception ex)
            {
                //some code
            }
        }






Some Help Please Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Aug 2010, 07:27 AM
Hi,

I saw a code library which illustrates how to expand/collapse grid items in hierarchical grid on row double-click. I hope this would help you in achieving the functionality.
Expand/collapse hierarchy client-side on double click


-Shinu.
Tags
Grid
Asked by
TAD RHODES
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or