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

OnRowDblClick for DetailTable Rows Only?

2 Answers 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 16 Dec 2011, 12:48 PM
I know I can register an event using ClientSettings.ClientEvents.OnRowDblClick, but this seems to fire for every row including any DetailTable instances in my grid.

Is there any way to either register a different event, or differentiate in some way (using a JavaScript function possibly) whether the event was fired from a master or detail table?  Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Dec 2011, 02:01 PM
Hello ,


<script type="text/javascript">
           function RowDblClick(sender, eventArgs) {
               debugger;
               if (eventArgs._tableView.get_name() == "Parent") {
 
               }
           }
 
       </script>

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
           AllowMultiRowSelection="true" OnGridExporting="RadGrid1_GridExporting"
           OnItemCreated="RadGrid1_ItemCreated"
           ondetailtabledatabind="RadGrid1_DetailTableDataBind">
           <MasterTableView CommandItemDisplay="Top" Name="Parent">
               <CommandItemSettings ShowExportToExcelButton="true" />
               <Columns>
                   <telerik:GridBoundColumn DataField="ID1" HeaderText="ID1" UniqueName="ID1">
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="CustomerName" HeaderText="CustomerName" UniqueName="CustomerName">
                   </telerik:GridBoundColumn>
                   <telerik:GridDateTimeColumn DataField="NoticeDate" HeaderText="Notice Date" UniqueName="NoticeDate"
                       DataFormatString="{0:d}" />
                   <telerik:GridEditCommandColumn>
                   </telerik:GridEditCommandColumn>
               </Columns>
               <DetailTables>
                   <telerik:GridTableView Name="Child">
                       <Columns>
                           <telerik:GridBoundColumn DataField="ID1" HeaderText="ID1" UniqueName="ID1">
                           </telerik:GridBoundColumn>
                           <telerik:GridBoundColumn DataField="CustomerName" HeaderText="CustomerName" UniqueName="CustomerName">
                           </telerik:GridBoundColumn>
                       </Columns>
                   </telerik:GridTableView>
                    
               </DetailTables>
           </MasterTableView>
           <ClientSettings>
           <ClientEvents OnRowDblClick="RowDblClick" />
               <Selecting AllowRowSelect="true" />
           </ClientSettings>
       </telerik:RadGrid>

Thanks,
Jayesh Goyani
0
Doug
Top achievements
Rank 1
answered on 16 Dec 2011, 03:38 PM
Thanks for that.

Unfortunately eventArgs._tableView.get_name() seems to return as undefined for me?

Update:  Ignore that, I wasn't assigning a name to my tables!  Thanks.
Tags
Grid
Asked by
Doug
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Doug
Top achievements
Rank 1
Share this question
or