I’ve got a requirement that needs a checkbox with rearranging capability in ASPNET MVC.
The main purpose is to know which checkbox users selected and allow them to rearrange the checkbox item order as they want.
My Question is, do there any existing control like this available in mvc(or jquery)? If no, do there any better UI control to fulfill my purpose?
I found the similar question with no appropriate answer.
listbox with checkboxes
I beg for your response. Thanks.
why don’t you use the normal checkbox with the jQuery-UI Sortable?
and then apply
You can easily convert the
<input id="chb-5" type="checkbox" value="5"/> Checkbox 5with the razor syntax:for persistence all you need to do is write the HTML is the correct order, let’s image you have this table:
all you need to do is:
You will always have the checkboxes sorted correctly on start, upon save all you need to do is loop through all checkboxes and update the new
Ordervalue.