Jquery MultiSelect auto postback
<p>I am using a jQuery multiselect dropdown in ASP.NET I need to get all the selected values, but I am getting only the last selected value from the dropdownlist on the server side after postback.</p>

<p>Script:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function () {
        $('.department).multiselect({
            show: ["bounce", 5], hide: ["blind", 1],
            close: function () {
                debugger;
                var values = new Array();
                $(this).multiselect("getChecked").each(function (index, item) {
                     values.push($(item).val());
                });
                $("input[id*=selectedValues]").val(values.join(","));
                document.getElementById("&lt;%=hdnDepartment.ClientID %&gt;").value = values;
           }
       })
      .multiselectfilter();
    });
&lt;/script&gt;
&lt;asp:HiddenField ID="hdnDepartment" runat="server"&gt;&lt;/asp:HiddenField&gt;
&lt;asp:HiddenField ID="hdnEmployee" runat="server" /&gt;
&lt;asp:DropDownList ID="ddlDepartment" runat="server" Width="150px" CssClass="department" onselectedindexchanged="ddlDepartment_SelectedIndexChanged" AutoPostBack="True"&gt;
&lt;/asp:DropDownList&gt;
</code></pre>
