Go to DotNetFunda.com
 Welcome, Guest!  
LoginLogin  
{ Submit content and get exposure !!! }
Submit: Article | Interview Question | Tips | Joke | Question | Link || Search  
 Skip Navigation Links Home > Interview/Exam Questions > Difference between DropDownList.Items.Add and DropDownList.Items.Insert method ...


.NET Interview Questions

Difference between DropDownList.Items.Add and DropDownList.Items.Insert method

Author: SheoNArayan | Posted on: 9/6/2008 10:12:06 AM | Category: ASP.NET | Views:872 |  Print Asked In: Many Interviews





Answer:
DropDownList.Items.Add method allows you to add new ListItem into the DropDownList. This item will be added as the last item of the DropDownList.

dropDownList.Items.Add(new ListItem("Default Panel", "0"));


DropDownList.Items.Insert method allows you to specify the index of the item within the DropDownList where you want to insert the ListItem.

dropDownList.Items.Insert(0, new ListItem("Default Panel", "0"));


Here Default Value will be added as the first item in the DropDown.


Interesting?  Bookmark and Share


Navigate to:

<< Previous Interview Question: How to convert a sentence into Title Case (Capitalize first character of every word)?

Next Interview Question >>: Difference between classes and structures?

Random Questions: Random Interview Questions

Help: If for some reason you are getting the same question by clicking Next and Previous, Try clicking Random Question or Category link above.


About Us | Contact Us | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
All rights reserved to DotNetFunda.com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)