Bind a Dropdownlist in ASP.NET

    Items to the dropdownlist can be added programmatically using ListItem class.
The below example shows adding of values to dropdownlist  in the program.

Populate Dropdownlist from Database

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
        DropDownList1.Items.Add(new ListItem("Apples", "1", true));
        DropDownList1.Items.Add(new ListItem("Mangoes", "2"));

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:DropDownList ID="DropDownList1" runat="server">