I am assgining values to the listbox through jquery. After assgining the values on button click event, i am not able to get the items in the list box. It shows empty item list. I am able to get the values through hidden field, but is there any better way around?
Thanks
Update
<script language="javascript" type="text/javascript">
$(function() {
$("#imgbtnRight,#imgbtnLeft").click(function(event) {
var id = $(event.target).attr("id");
var selectFrom = id == "imgbtnRight" ? "[id*=lbAllStores]" : "[id*=lbIncludedStores]";
var moveTo = id == "imgbtnRight" ? "[id*=lbIncludedStores]" : "[id*=lbAllStores]";
var selectedItems = $(selectFrom + " option:selected").toArray();
$(moveTo).append(selectedItems);
});
});
When the page posts back to the server, the contents of the DOM are not sent back to ASP .net. The only information from the page is contained in the form elements (think
<input>tags) submitted to the server, such as hidden fields. The only other way to solve this is to start using ajax to send the data back to the server instead of a postback.