 DropDownList’s Item collection. You can use the well suited overloaded method of ListItem class constructor to add a new item.
dropdownlist is an asp.net list web server control that allow users to select a single item at a time. developers can add list items to dropdownlist control at design time or programmatically at run time or data bind with a data source control. Add items using data binding. For details, see How to: Populate List Web Server Controls from a Data Source. You can add items from a data source to static items you create at design time. When you add a list item, you specify up to three possible properties of the item, as described in the following table. The information in this topic applies to all list Web server controls: ListBox, DropDownList, CheckBoxList, RadioButtonList, and BulletedList. You can add items to a list Web server control in these ways: Add static items at design time. Add items programmatically at run time. The DropDownList helper used to create an HTML select list requires a, either explicitly or implicitly. That is, you can pass the explicitly to the DropDownList helper or you can add the to the ViewBag using the same name for the SelectListItem as the model property. Get the output for above discussed code from the following link: Populate DropDownList Items Dynamically. Continue to the next tutorial: Setting ASP.Net Dropdownlist Default Value to learn how to select a list item to display it as default value of dropdownlist control. In this line we are using the HTML Helper DropDownListFor method to create a dropdownlist, in other words HTML select element. We are using the property SubjectList that contains all list items of subjects that bind to it. It generates the following HTML code. Following are the two overloaded ways for using the Add method of Items collection property of DropDownList: 1. It allows you to add the specified list item at the end of DropDownList’s Item collection. You can use the well suited overloaded method of ListItem class constructor to add a new item. 2. It appends the collection of list items of DropDownList control by adding the specified string at the end of items the following example code demonstrate us how can we add list item programmatically at run time using c# script section. dropdownlist Items property get the collection of items in the dropdownlist. we can add a ListItem to this items collection using its Add method (ListItemCollection.Add method).
http://asp-net-example.blogspot.com/2008/12/aspnet-dropdownlist-how-to-add-list.html https://msdn.microsoft.com/en-us/library/14atsyf5(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/14atsyf5(v=vs.85).aspx http://www.asp.net/mvc/overview/older-versions/working-with-the-dropdownlist-box-and-jquery/using-the-dropdownlist-helper-with-aspnet-mvc http://www.ezineasp.net/post/Populate-ASP-Net-DropDownList-by-Adding-Items-Dynamically.aspx http://www.c-sharpcorner.com/UploadFile/3d39b4/dropdownlist-in-Asp-Net-mvc/ http://www.ezineasp.net/post/Populate-ASP-Net-DropDownList-by-Adding-Items-Dynamically.aspx http://asp-net-example.blogspot.com/2008/12/aspnet-dropdownlist-how-to-add-list.html
add items to dropdownlist html