Click here to Skip to main content
15,892,222 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
HI,
i am having one doubt,what is the difference between dropdownlist and list box ? and how to create these controls in html ....??

can any one tell me?

Thanks in Advance....:)
Posted
Comments
ZurdoDev 9-Jun-15 16:59pm    
Dropdown has a an arrow that drops down.
Listbox is a box that has a list of items.

These are very simple, easy, questions. Do you have visual studio? Just drop them on a page and see what they are.

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Jun-15 2:00am    
I voted 4 this time. It wold be good to explain how it works, as our inquirer is apparently confused with the principles. Besides, there are different implementation of similar things under the same names in "System.Web.Mvc" and "System.Web", which are different assemblies. I tried to clarify it in Solution 2, please see.
—SA
First of all, note that the question about "difference" makes no sense, as it usually happens with this uncertain concept. What would it supposed to mean? Instead of asking about "difference", you just need to understand how things work.

If I could take your question literally, from its title and body, I would have to ignored the question tags because, strictly speaking, they are not directly related to HTML, and the question is HTML. Then the answer would be: in HTML, there are not drop-down boxes or list boxes. There is one HTML element which play such roles, depending on some options: <select> element:
https://www.w3.org/wiki/HTML/Elements/select[^].

As to the classes named ListBox or DropDownList, they are just the wrappers using this HTML document. When you use such classes, the ASP.NET HTTP response generates HTML with <select> element. In particular, in "System.Web.Mvc", this is based on the class System.Web.Mvc.Html.SelectExtensions which provides a way to render different forms of this elements using appropriate static method (something like factory methods): https://msdn.microsoft.com/en-us/library/system.web.mvc.html.selectextensions%28v=vs.118%29.aspx[^].

There are similar classes in the assembly "System.Web": https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v2
1.All two control are ways to present data to the user so they can select it, although List-box shows many options to the user simultaneously(press control button) and lets them pick one or more, whereas Drop-down lets them choose only one.

2.In drop-down if you write multiple then it act as list-box other wise normal drop-down.


Example for dropdown

XML
<select>
  <option value="volvo">C#</option>
  <option value="saab">Asp</option>
  <option value="mercedes">Ado</option>
  <option value="audi">Mvc</option>
</select>



Example for listbox

XML
<select multiple>
  <option value="volvo">C#</option>
  <option value="saab">Asp</option>
  <option value="mercedes">Ado</option>
  <option value="audi">Mvc</option>
</select>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900