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

Row Reorder Using CommandItem

3 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bryan Hughes
Top achievements
Rank 1
Bryan Hughes asked on 16 Jun 2009, 04:50 PM
I have Item Drag and Drop workng for row reorder.  I also need to make a commandItem that can reorder rows (up arrow button and down arrow button).  How can I do this.

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 18 Jun 2009, 10:49 AM
Hi Bryan Hughes,

You can create your custom button or other control in MasterTableView's CommandItemTemplate and set its CommandName property to some custom command name, e.g. "Reorder". After that, in RadGrid's ItemCommand event you can check if your command name is the given one and reorder your rows as you do with drag and drop:

void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    if(e.CommandName == "Reorder"
    { 
        //execute your custom row reorder logic 
    } 
 


Best wishes,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bryan Hughes
Top achievements
Rank 1
answered on 18 Jun 2009, 06:15 PM
Thank you Veli, can I get in VB.NET code please ?
0
Princy
Top achievements
Rank 2
answered on 19 Jun 2009, 04:32 AM
Hello Bryan,

Check out the Vb code for the above given code:
vb:
Sub RadGrid1_ItemCommand(source As Object, e As Telerik.Web.UI.GridCommandEventArgs) 
            'execute your custom row reorder logic  
    If e.CommandName = "Reorder" Then 
 
    End If 
End Sub 
You can use the following code converter tool to convert codes from C# to VB and vice versa:
code converter

Thanks
Princy.
Tags
Grid
Asked by
Bryan Hughes
Top achievements
Rank 1
Answers by
Veli
Telerik team
Bryan Hughes
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or