Checkbox Control In Dropdownlist Control In Asp.Net

Checkbox Control In Dropdownlist Control In Asp.Net

In this post we will learn How To Use Checkbox Control In Dropdownlist Control In Asp.Net, or you can say DropDownCheckBoxes in CheckBoxList control in ASP.NET.

ASP.NET provides DropDownList and CheckBoxList server controls  but there is no controls available for DropDownList with multi select option.

DropDownCheckBoxes is a server control provides functionality to select multiple items in DropDownList. ASP.NET Web Forms 3.5, 4.0, can work with both synchronous postbacks and asynchronous when the control is placed within UpdatePanel control.

You can download DropDownCheckBoxes.dll by following the link given.

Download the above mention DLL file from given link and then Add Reference > Select DLL file and use it.

Web.Config Changes(Register Component):

<add tagPrefix=”uasp” namespace=”Saplin.Controls” assembly= “DropDownCheckBoxes”/>

Design View:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
<title>Checkbox Control In Dropdownlist Control In Asp.Net</title>
<style type="text/css">
 width: 980px;
 margin: 0px auto;
 text-align: center;
 padding-top: 50px;
 font-size: 18px;
<form id="form1" runat="server">
<h2>Checkbox Control In Dropdownlist Control In Asp.Net</h2>
Select Country:<uasp:DropDownCheckBoxes ID="ddchk" runat="server">
<Style SelectBoxWidth="200" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="200" /> 
<Texts SelectBoxCaption="Select Country" />

<asp:Button ID="submit" runat="server" Text="Submit" OnClick="submit_Click" />

<br /><br />
<asp:Label ID="selectedcontry" runat="server"></asp:Label>
<br /><br />
<br /><br />
<br /><br />
<br /><br />
All rights reserved by <a href=""></a>
| Hosting partner <a href="" target="_blank">Grootstech</a>   


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
    protected void BindData()
        SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=hightechnology;Integrated Security=True");
        DataSet ds = new DataSet();
        string cmdstr = "select CountryID,Country from Country_list";
        SqlDataAdapter adp = new SqlDataAdapter(cmdstr, conn);

        if (ds.Tables[0].Rows.Count > 0)
            ddchk.DataSource = ds.Tables[0];
            ddchk.DataTextField = "Country";
            ddchk.DataValueField = "CountryID";
    protected void submit_Click(object sender, EventArgs e)
        List<String> ContryName_list = new List<string>();
        foreach (System.Web.UI.WebControls.ListItem item in ddchk.Items)
            if (item.Selected)
            selectedcontry.Text = "Country Name: " + String.Join(",", ContryName_list.ToArray());