asp.net - Add Item from Dropdownlist to ListBox using JQuery -
how can add user selected dropdownlist listbox using jquery? , when post page should able retrieve "id, name" listbox.
<asp:dropdownlist id="ddlperson" datasourceid="ods_person" datavaluefield="id" datatextfield="name" runat="server" width="221px" /><br /> <asp:listbox id="lstperson" runat="server" width="245px" font-bold="true" forecolor="green" selectionmode="multiple"> </asp:listbox> <br>
to add items dropdown can use following script
<script type="text/javascript"> $(function () { $('[id$=items]').change(function (e) { var option = $('<option/>').html($(e.currenttarget).val()); $('[id$=listbox]').append(option); }); }); </script>
but run issue. items added listbox not persisted list box's "items" on server. need add these values hidden field on client , split values on server.
Comments
Post a Comment