title: Populate multiselect box using jquery
body: <p>i can populate dropdownlist using jquery as below :</p>
  
  <p>Dropdownlist :</p>
  
  <pre><code>&lt;select id="province"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>Script code :</p>
  
  <pre><code>$(document).ready(function(){
      $.ajax({
              type: "POST",
              url: "function.aspx/provincelist",
              data: "",
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: function OnPopulateControl(response) {
                  list = response.d;
                  if (list.length &gt; 0) {
                      $("province").removeAttr("disabled");
                      $("province").empty().append('&lt;option value="0"&gt;Please select&lt;/option&gt;');
                      $.each(list, function () {
                          $("province").append($("&lt;option&gt;&lt;/option&gt;").val(this['Value']).html(this['Text']));
                      });
                      $("province").val(valueselected);
                  }
                  else {
                      $("province").empty().append('&lt;option selected="selected" value="0"&gt;Not available&lt;option&gt;');
                  }
              },
              error: function () {
                  alert("Error");
              }
          });
  
  });
  </code></pre>
  
  <p>File function.aspx with provincelist function :</p>
  
  <pre><code>[System.Web.Services.WebMethod]
      public static ArrayList provincelist()
      {
          ArrayList List = new ArrayList();
          SqlConnection con = DBclass.moketnoi();
          SqlCommand cmd = new SqlCommand("SELECT TC_CODE, TC_NAME FROM PM_PROVINCE", con);
          SqlDataReader sdr = cmd.ExecuteReader();
          while (sdr.Read())
          {
              List.Add(new ListItem(
                  sdr["TC_NAME"].ToString(),
                  sdr["TC_CODE"].ToString()
                  ));
          }
          con.Close();
          return List;
      }
  </code></pre>
  
  <p>How can I populate multi-select box by the same way above, please help me. Thanks so much.
  (i use multi-select box plugin <a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/" rel="noreferrer">http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/</a>, but I can populate with data from server )</p>