I want to create a dropdown list using ASP.NET HTML Helpers and Im looking for a way to set the default selected value of the list with a single argument (Like the index of the element selected by default for example).List itemsnew List() Public Class DropDownList Inherits ListControl Implements IPostBackDataHandler.Bind the data to the control. ColorList.DataBind() . Set the default selected item, if desired. The item in SelectedValue exists within the list, but the first item in the list is always defaulted to selected. How should I be doing this?When Html.DropDownList(UserId is changed to any other name but UserId, the selected value is rendered correctly. This is where I create the ViewBag variable, note the id, this is what I want to use to set the default selected item in the listHtml.DropDownList("id", (MultiSelectList)ViewBag.EventsList, new class "form-control", id "lstTopFeaturedEvent" ). The default value is 0, which selects the first item in the list.The following code example demonstrates how to use the SelectedIndex property to determine the selected item in the DropDownList control. I want to select "Algeria" as default selected value in drop down list.I am fetching countrylist from database using handler ( LoadCountryList.ashx ) in JSON data format and binding it to dropdownlist on aspx page using Jquerys .
getJSONMVC :: Select Item In Html.DropDownlist By Checkbox. In Edit.chtml, I have a field for "MANAGERS" that I need to populate with a dropdownlist of names with default/selected value displayed corresponding to the ID of the rowI am using viewBag but my problem is the dropdownlist is always displaying the first item in the list and not the selected value. 2) How can I set a default selected value in Html.DropDownList ? You could build your select "by hands"