could any body explain me how can i save state of two list boxes on post back i am using jQuery of this kind i dont know on what event what should i do or where can i save view state or how can i use hiddenField to persist the state of both list box
<script language="javascript" type="text/javascript">
$(document).ready(function() {
//If you want to move selected item from fromListBox to toListBox
$("#add").click(function() {
$("#"+'<%= fromListBox.ClientID %>'+" option:selected").appendTo("#"+'<%=toListBox.ClientID %>');
});
//If you want to move all item from fromListBox to toListBox
$("#addAll").click(function() {
$("#"+'<%= fromListBox.ClientID %>'+" option").appendTo("#"+'<%=toListBox.ClientID %>');
});
//If you want to remove selected item from toListBox to fromListBox
$("#remove").click(function() {
$("#"+'<%=toListBox.ClientID %>'+" option:selected").appendTo("#"+'<%= fromListBox.ClientID %>');
});
//If you want to remove all items from toListBox to fromListBox
$("#removeAll").click(function() {
$("#"+'<%=toListBox.ClientID %>'+" option").appendTo("#"+'<%= fromListBox.ClientID %>');
});
});
</script>
<asp:ListBox ID="fromListBox" runat="server" SelectionMode="Multiple" Height="150px" Width="150px" >
<asp:ListItem Text="Student Enrollment ID" Value="enrollment_no"></asp:ListItem> <asp:ListItem Text="Student Name" Value="first_name"></asp:ListItem> <asp:ListItem Text="Last Name" Value="last_name"></asp:ListItem> <asp:ListItem Text="Father Name" Value="father_name"></asp:ListItem>
</asp:Listbox>
<asp:ListBox runat="server" ID="toListBox" ></asp:ListBox>