What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 4640 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > ASP.NET Interview Questions > Difference between DropDownList and List ...

Difference between DropDownList and ListBox in ASP.NET

Interview question and answer by: Poster | Posted on: 2/4/2010 | Category: ASP.NET Interview questions | Views: 11901 |


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:


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Poster

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 5:00:26 AM