DropDownHelper.GetDropdown Method (IEnumerable(String), Int32)

Template MVC

DropDownHelperGetDropdown Method (IEnumerableString, Int32)

Generate a list of SelectListItem using a normal list of String as key and value

Namespace:  Template.Web.Commons.Utils
Assembly:  Template.Web (in Template.Web.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static IEnumerable<SelectListItem> GetDropdown(
	IEnumerable<string> listdata,
	int selected = 0
)

Parameters

listdata
Type: System.Collections.GenericIEnumerableString
The source String list
selected (Optional)
Type: SystemInt32
Index of which element whatns to be selected of the begining, default 0

Return Value

Type: IEnumerableSelectListItem
A list of SelectedListItem ready to use as a source of a dropdown with Razor
See Also