SelectListItem

.SelectListItem()

Creates a SelectListItem from a a supplied ID and value. Generally useful inside lamda functions.

Method

public static Func<object, string, SelectListItem> SelectListItem = (object id, string text)
object id

Id value for the select list item. This will be converted to a string.

string text

The text value to show in the drop down list.

Example

C#
ViewBag.List = db.MySpGet().ToSelectList(x => SiUtil.SelectListItem(x.MyFieldId, x.MyField));