title: How can i show the selected items as comma separated in the Multi select dropdown text field in asp.net
body: <p>In my web application, i am trying to do show the selected items as comma separated in the Multi select drop down text field is it possible to do and how can i do this can any one tell me. sample image is link <a href="http://i.stack.imgur.com/rT12a.png" rel="nofollow">[As Shown in figure]</a></p>
  
  <p>I tried:</p>
  
  <p>.aspx: </p>
  
  <pre><code>&lt;asp:DropDownCheckBoxes ID="dropdown1" runat="server" UseSelectAllNode="true" UseButtons="true" OnSelectedIndexChanged="dropdown1_SelectedIndexChanged" AutoPostBack="true"&gt;&lt;Style DropDownBoxBoxWidth="200"/&gt;&lt;/asp:DropDownCheckBoxes&gt;
  </code></pre>
  
  <p>.CS</p>
  
  <pre><code>      public void ddlsbind()
      {
      string str=string.Empty;
                  string query = "select distinct col1 from Collection where sample='" + ddl2.SelectedItem.Text.ToString() + "' and col1 IS NOT NULL";            
   SqlCommand cmd = new SqlCommand(query, con);
                  DataTable dt = new DataTable();
                  SqlDataAdapter da = new SqlDataAdapter(cmd);
                  da.Fill(dt);        
                  ddlInsurance.DataSource = dt;
                  ddlInsurance.DataTextField = "col1";
                  ddlInsurance.DataValueField = "col1";
                  ddlInsurance.DataBind();
      }
  </code></pre>
  
  <p>Can anyone help me to how to do this.<br>
  Thank you</p>