Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Articles Author
Fri, 01-Aug-2014 Authors
All Time Authors
Vishal@Neeraj
28880
Rajkatie
20600
Bharathi Cherukuri
18040

Latest members | More ...


(Statistics delayed by 5 minutes)

Difference between DropDownList and ListBox in ASP.NET

 Posted by Poster on 2/4/2010 | Category: ASP.NET Interview questions | Views: 19198

Answer:

The basic difference between DropDownList and ListBox in ASP.NET are following

1. Only one items of DropDownList is visible when it renders on the page. More than one item of the ListBox is visible when it renders on the page.
2. Only one item can be selected in DropDownList. More than one item can be selected in Listbox provided SelectionMode is Multiple as in the below code snippets.

Both controls are rendered as "<select>" html tag in the HTML.

DROPDOWNLIST
<asp:DropDownList ID="drop1" runat="server">

<asp:ListItem Text="One" Value="1" />
<asp:ListItem Text="Two" Value="2" />
</asp:DropDownList>


For more details on DropDownList click http://www.dotnetfunda.com/tutorials/controls/dropdownlist.aspx

LIST BOX
 <asp:ListBox ID="list1" runat="server" SelectionMode="Multiple">

<asp:ListItem Text="One" Value="1" />
<asp:ListItem Text="Two" Value="2" />
</asp:ListBox>


For more details on ListBox click http://www.dotnetfunda.com/tutorials/controls/listbox.aspx

Thank you.


Asked In: Many Interviews | Alert Moderator 

Found interesting? Add this to:



Comments or Responses

Login to post response