Note that there are some explanatory texts on larger screens.

plurals
  1. POlistBox And Jquery
    primarykey
    data
    text
    <p>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</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; $(document).ready(function() { //If you want to move selected item from fromListBox to toListBox $("#add").click(function() { $("#"+'&lt;%= fromListBox.ClientID %&gt;'+" option:selected").appendTo("#"+'&lt;%=toListBox.ClientID %&gt;'); }); //If you want to move all item from fromListBox to toListBox $("#addAll").click(function() { $("#"+'&lt;%= fromListBox.ClientID %&gt;'+" option").appendTo("#"+'&lt;%=toListBox.ClientID %&gt;'); }); //If you want to remove selected item from toListBox to fromListBox $("#remove").click(function() { $("#"+'&lt;%=toListBox.ClientID %&gt;'+" option:selected").appendTo("#"+'&lt;%= fromListBox.ClientID %&gt;'); }); //If you want to remove all items from toListBox to fromListBox $("#removeAll").click(function() { $("#"+'&lt;%=toListBox.ClientID %&gt;'+" option").appendTo("#"+'&lt;%= fromListBox.ClientID %&gt;'); }); }); &lt;/script&gt; &lt;asp:ListBox ID="fromListBox" runat="server" SelectionMode="Multiple" Height="150px" Width="150px" &gt; &lt;asp:ListItem Text="Student Enrollment ID" Value="enrollment_no"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="Student Name" Value="first_name"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="Last Name" Value="last_name"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="Father Name" Value="father_name"&gt;&lt;/asp:ListItem&gt; &lt;/asp:Listbox&gt; &lt;asp:ListBox runat="server" ID="toListBox" &gt;&lt;/asp:ListBox&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload