In this article I will explain a Custom ASP.Net Server control DropDownCheckBoxes which is a Multiple Selection DropDownList consisting of a CheckBoxList control within it.
This control is a pure Server side control which combines all the events and properties of an ASP.Net DropDownList and CheckBoxList and it also includes its own RequiredFieldValidator that performs validation as the ASP.Net RequiredFieldValidator.
 
 
Download DropDownCheckBoxes DLL
You need to download the DLL from the following location.
Once the DLL is downloaded you need to place it inside the BIN folder of your project.
 
 
Registering the DropDownCheckBoxes DLL
Once the DLL is placed inside the BIN folder you will need to register the control on the page using the Register directive as shown below.
<%@ Register TagPrefix="asp" Namespace="Saplin.Controls" Assembly="DropDownCheckBoxes" %>
 
 
HTML Markup
The following HTML Markup consists of DropDownCheckBoxes control. The DropDownCheckBoxes control has a UseSelectAllNode property which when set to TRUE, it will display an additional Select All CheckBox.
The library also includes a validator for the DropDownCheckBoxes control which is known as ExtendedRequiredFieldValidator
<asp:DropDownCheckBoxes ID="DropDownCheckBoxes1" runat="server" Width="180px" UseSelectAllNode = "false">
    <Style SelectBoxWidth="195" DropDownBoxBoxWidth="160" DropDownBoxBoxHeight="90" />
    <Items>
        <asp:ListItem Text="Mango" Value="1"></asp:ListItem>
        <asp:ListItem Text="Apple" Value="2"></asp:ListItem>
        <asp:ListItem Text="Banana" Value="3"></asp:ListItem>
    </Items>
</asp:DropDownCheckBoxes>
&nbsp;
<asp:ExtendedRequiredFieldValidator ID = "ExtendedRequiredFieldValidator1" runat = "server" ControlToValidate = "DropDownCheckBoxes1" ErrorMessage = "Required" ForeColor = "Red"></asp:ExtendedRequiredFieldValidator>
<br />
<br />
<asp:Button Text="Submit" runat="server" OnClick = "Submit" />
 
 
Fetching the selected values on Server Side on Button click
When the Button is clicked, a loop is executed over the Items of the DropDownCheckBoxes controls and the selected Items are displayed using JavaScript alert message box.
C#
protected void Submit(object sender, EventArgs e)
{
    string message = string.Empty;
    foreach (ListItem item in DropDownCheckBoxes1.Items)
    {
        if (item.Selected)
        {
            message += item.Text + " " + item.Value + "\\n";
        }
    }
    ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + message + "');", true);
}
 
VB.Net
Protected Sub Submit(sender As Object, e As EventArgs)
    Dim message As String = String.Empty
    For Each item As ListItem In DropDownCheckBoxes1.Items
        If item.Selected Then
            message += item.Text + " " + item.Value + "\n"
        End If
    Next
    ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", "alert('" & message & "');", True)
End Sub
 
 
Screenshot
DropDownCheckBoxes: ASP.Net DropDownList CheckBoxList Server control
 
 
Downloads