locked
How to show listbox mover buttons RRS feed

  • Question

  • User559005402 posted

    Is there a way to show mover buttons in a listbox so the user can rearrange the order of the items in the listbox?

    Tuesday, June 24, 2008 2:53 PM

Answers

  • User-1034726716 posted


    Is there a way to show mover buttons in a listbox so the user can rearrange the order of the items in the listbox?

    See if this helps 

    http://www.c-sharpcorner.com/Blogs/BlogDetail.aspx?BlogId=315 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 24, 2008 4:30 PM

All replies

  • User1213324388 posted

    This is ajax type behavior, so you could probably use the ReorderList control in the Ajax Control Toolkit. You can see it working here: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ReorderList/ReorderList.aspx

    Tuesday, June 24, 2008 2:59 PM
  • User2064313513 posted

    Those not build in buttons to the listbox. You can easily make buttons that change the position of the currently selected item.

    When an item is selected check to see if it is at the top or bottom first.

     if at top, only show the down button. if at bottom only show up button.

    if the up button is clicked then change the index of the currently selected value to its index - 1

    if the down button is clicked add 1 to the current index;

    Tuesday, June 24, 2008 3:08 PM
  • User559005402 posted

    Those not build in buttons to the listbox. You can easily make buttons that change the position of the currently selected item.

    When an item is selected check to see if it is at the top or bottom first.

     if at top, only show the down button. if at bottom only show up button.

    if the up button is clicked then change the index of the currently selected value to its index - 1

    if the down button is clicked add 1 to the current index;

    Do you have a code sample? My attempt doesn't seem to work. 
        Protected Sub cmdDown_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdDown.Click
            lstSubgroups.SelectedIndex = lstSubgroups.SelectedIndex + 1
        End Sub
    
        Protected Sub cmdUp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUp.Click
            lstSubgroups.SelectedIndex = lstSubgroups.SelectedIndex - 1
        End Sub
     
    Tuesday, June 24, 2008 4:26 PM
  • User-1034726716 posted


    Is there a way to show mover buttons in a listbox so the user can rearrange the order of the items in the listbox?

    See if this helps 

    http://www.c-sharpcorner.com/Blogs/BlogDetail.aspx?BlogId=315 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 24, 2008 4:30 PM
  • User-1034726716 posted

    If you want server side manipulation then you can refer here

    http://www.codeproject.com/KB/webforms/MCEnhancedListBoxControl.aspx 

    Tuesday, June 24, 2008 4:37 PM
  • User559005402 posted

    Thanks Vinz. Got it.

    Tuesday, June 24, 2008 6:41 PM