jquery ui - copy data from one Html.listboxfor to other listbox in asp.net mvc -



jquery ui - copy data from one Html.listboxfor to other listbox in asp.net mvc -

i have 2 html.listboxfor called a & b.

1) a has info populated db & b empty.

2) want functionality this items list a placed list b.

$('.add').on('click', function() { var options = $('select.multiselect1 option:selected').sort().clone(); $('select.multiselect2').append(options); }); $('.addall').on('click', function() { var options = $('select.multiselect1 option').sort().clone(); $('select.multiselect2').append(options); }); $('.remove').on('click', function() { $('select.multiselect2 option:selected').remove(); }); $('.removeall').on('click', function() { $('select.multiselect2').empty(); });

3) tried asp.net mvc, unable fetch selected items in model & controller.

4) want way can perform in asp.net mvc. if there can way in mvc able store info in sql db

5) jquery sibling here

any help appreciated

i think help you.

blockquote

html file

fruits: <select multiple="multiple" id="a"> <option value="1">apple</option> <option value="2">orange</option> <option value="3">banana</option> </select> <input type="button" id="add" value="add"/> <input type="button" id="addall" value="add all"/> <select multiple="multiple" id="b"> </select>

javascript file

$("#add").bind("click", function () { addoption(false); }); $("#addall").bind("click", function () { addoption(true); }); function addoption(isall){ var alternative = $("#a option"); if (!isall) { alternative = $("#a option:selected"); } else { $("#b").html(""); } $(option).each(function () { var val = $(this).val(); var text = $(this).text(); $("#b").append($(this)[0].outerhtml); $(this).remove(); }); }

jquery-ui model-view-controller jquery asp.net-mvc-4

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -