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

Drage to reorder rows on only one detail grid

2 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henry Derstine
Top achievements
Rank 1
Henry Derstine asked on 09 Mar 2009, 07:51 PM
Hello, I have a parent grid with two detail grids on the same level inside the parent. I have set up where you can reorder rows by dragging and dropping based on the demo. But, I am only interested in allowing one of the detail grids to have this functionality. All I want is to allow child grid 1 to be reordered. The parent and the other child do not need any functionailty. I can't seem to figure out how to not allow the drag and drop for the others. Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Mar 2009, 04:27 AM
Hi,

Set the Name property for the Master table and Detail tables. Try out the following client side code and see whether it works.

ASPX:
<telerik:RadGrid ID="RadGrid1"   Name="Master"   AutoGenerateDeleteColumn="true"  > 
   ......... 
    ......... 
 
             <DetailTables> 
                 <telerik:GridTableView Name="Detail1" AutoGenerateColumns="false" runat="server"  DataSourceID="SqlDataSource2" > 
                   <Columns> 
                     <telerik:GridBoundColumn UniqueName="ProductName" DataField="ProductName"  HeaderText="ProductName" ></telerik:GridBoundColumn> 
                   </Columns> 
                 </telerik:GridTableView> 
                 
                  <telerik:GridTableView Name="Detail2" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSource3" > 
                   <Columns> 
                     <telerik:GridBoundColumn UniqueName="ProductID" DataField="ProductID"  HeaderText="ProductID" ></telerik:GridBoundColumn> 
                   </Columns> 
                 </telerik:GridTableView> 
                   
              </DetailTables> 
 
             .......... 
            <ClientSettings  AllowRowsDragDrop="true" > 
             <Selecting  AllowRowSelect="true" /> 
             <ClientEvents  OnRowDragStarted="OnRowDragStarted" /> 
            </ClientSettings> 
 
             ...... 
 
 </telerik:RadGrid> 
 

JS:
<script type="text/javascript" > 
 function OnRowDragStarted(sender, eventArgs) 
 { 
 var tableView = eventArgs.get_tableView(); 
    if(eventArgs.get_tableView().get_name() != "Detail1"
      { 
       eventArgs.set_cancel(true
      } 
 } 
 
  
</script> 
 


Regards
Shinu





0
Henry Derstine
Top achievements
Rank 1
answered on 10 Mar 2009, 12:10 PM
That did the trick. Thanks a lot
Tags
Grid
Asked by
Henry Derstine
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Henry Derstine
Top achievements
Rank 1
Share this question
or