title: Drag and Drop item from one listbox to another in asp.net
body: <p>Hi i want to use drag and drop functionality of jquery UI in my form. I bind the first lisbox item from the database. What i want is to drag item from list1 to list2. I tried the following code to implement it which i could not achieved. Please help me to overcome this problem.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"&gt;
    &lt;script src="//code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
    &lt;script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"&gt;&lt;/script&gt;
  
    $(function () {
          $("#list1, #list2").sortable({
              connectWith: ".connectedSortable"
          }).disableSelection();
      });
  &lt;/script&gt;
  
     &lt;style&gt;
        #list1, #list2 {
        border: 1px solid #eee;
        width: 142px;
        min-height: 20px;
        list-style-type: none;
        margin: 0;
       padding: 5px 0 0 0;
       float: left;
       margin-right: 10px;
      }
  
     #list1li, #list2 li {
     margin: 0 5px 5px 5px;
     padding: 5px;
     font-size: 1.2em;
     width: 120px;
     }
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;asp:ListBox ID="list1" runat="server" Height="300px" Width="250px" class="connectedSortable"&gt;&lt;/asp:ListBox&gt;
  &lt;asp:ListBox ID="list2" runat="server" Height="300px" Width="250px" class="connectedSortable"&gt;&lt;/asp:ListBox&gt;
  </code></pre>
  
  <p>code behind to bind list1 listbox control</p>
  
  <pre><code>public void BindListbox()
  {
  
      SqlConnection con = new SqlConnection(constr);
      SqlCommand cmd = new SqlCommand();
      cmd.CommandType = CommandType.StoredProcedure;
      cmd.CommandText = "[get_names]";
      cmd.Connection = con;
  
      try
      {
          con.Open();
          list1.DataSource = cmd.ExecuteReader();
          list1.DataTextField = "Antibiotic";
          list1.DataValueField = "AntibioticId";
          list1.DataBind();
      }
  
      catch (Exception ex)
      {
          Response.Write("Error occured: " + ex.Message.ToString());
      }
      finally
      {
          con.Close();
          con.Dispose();
      }
  }
  </code></pre>