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

Disabling GridDragDrop row in grid

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mak
Top achievements
Rank 1
Mak asked on 28 May 2012, 04:24 PM
Hi there,

we have recently implemented the drag-drop feature within the Telerik RadGrid using the demo provided by yourselves: 
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx 

This is working beautifully however we have had a request to disable the drag-drop feature on 1 or 2 'unsortable' rows, could you please provide some indication on how to acheive this? we have attempted casting the object, on ItemDataBound, to a Telerik.Web.UI.GridDataItem and then setting enable=false but this doesnt seem to be working.

Hope you can be of assistance

Regards

A.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 May 2012, 07:03 PM
Hello Ahmed,

You can achieve this thing by below code.(on client side) .
<script type="text/javascript">
 function RowDragStarted(sender, args) {
               // Using DataKey
               if (args.getDataKeyValue("ID") == "1") {
                   args.set_cancel(true);
               }
 
               //Using index
               if (args.get_gridDataItem()._itemIndexHierarchical == 2) {
                   args.set_cancel(true);
               }
           }
       </script>

<telerik:RadGrid>
.........
.........
            <MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID" >
.........
.........


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Mak
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or