How to Add DropDownList ListItem Add in Asp.Net C#


A DropDownList is also commonly known as combo box.

 It can contain multiple data members, but unlike a normal list box the users can choose only one value from this control.

Asp.Net dropdownlist web server control enables user to select a single item from list item collection. 

Though the functionality of this DropDownList is much like a Single Row Select List Box, a DropDownList can save a lot of GUI space as it is rendered on a Single line and is expanded only when the user clicks on the Control.

dropdownlist display a collection of list items. list item have two main properties Text and Value.

 Text represent the content which display on browser and Value represent a hidden text associated with specific list item.

we can populate dropdownlist from various data sources. 

we also can add dropdownlist list item manually by write them between opening and closing tags. 

   First  Select - DropDownList  From ToolBox - Select  Edit Items

Html  Coding

<html xmlns="">
<head id="Head1" runat="server">
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Country Name"></asp:Label>
            <asp:DropDownList ID="DropDownList1" runat="server">
                <asp:ListItem>Select  Country</asp:ListItem>
                <asp:ListItem>New Zeland</asp:ListItem>


  Next - Click ADD Button  Required  ListItem  Selected

      Select  ListItem  Text  Value Change  Required  Name
       Bottom & up Key used to Move the selected ListItem

       Select - One Listitem(Australia) -  Move to Top 


Next - Click - OK - Button - Go to  Design Page


 Next - F5 Run the Program  - Select  Drop Down Key   Show  List Items



Post a Comment