Helper extensions for work with IDataModels.
Converts a collection of IDataModels to a list of dropdown options.
public List<SelectListItem> ToSelectListItemList(list, valuePropertyName, textPropertyName, addEmptyItem)
A list of SelectListItems.
Name | Type | Summary |
---|---|---|
list | IEnumerable<IDataModel> | An IDataModel connection to convert. |
valuePropertyName | String | The name of the property that contains the value. |
textPropertyName | String | The name of the property that contains the text. |
addEmptyItem | Boolean | true if an empty item must be added, otherwise false. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when list is null. |
In this document