Share via


SelectExtensions.ListBoxFor 方法

定义

重载

ListBoxFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, IEnumerable<SelectListItem>, IDictionary<String,Object>)

使用指定的列表项和 HTML 属性为由指定表达式表示的对象中的每个属性返回 HTML select 元素。

ListBoxFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, IEnumerable<SelectListItem>)

使用指定列表项,为由指定表达式表示的对象中的每个属性返回对应的 HTML select 元素。

ListBoxFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, IEnumerable<SelectListItem>, Object)

使用指定的列表项和 HTML 属性为由指定表达式表示的对象中的每个属性返回 HTML select 元素。

ListBoxFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, IEnumerable<SelectListItem>, IDictionary<String,Object>)

使用指定的列表项和 HTML 属性为由指定表达式表示的对象中的每个属性返回 HTML select 元素。

public static System.Web.Mvc.MvcHtmlString ListBoxFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ListBoxFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBoxFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

类型参数

TModel

模型的类型。

TProperty

属性的类型。

参数

htmlHelper
HtmlHelper<TModel>

此方法扩展的 HTML 帮助器实例。

expression
Expression<Func<TModel,TProperty>>

一个表达式,用于标识包含要显示的属性的对象。

selectList
IEnumerable<SelectListItem>

用于填充下拉列表的 对象的集合 SelectListItem

htmlAttributes
IDictionary<String,Object>

一个 对象,该对象包含要为 元素设置的 HTML 属性。

返回

一个由表达式表示的对象中的每个属性所对应的 HTML select 元素。

例外

expression 参数为 null。

适用于

ListBoxFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, IEnumerable<SelectListItem>)

使用指定列表项,为由指定表达式表示的对象中的每个属性返回对应的 HTML select 元素。

public static System.Web.Mvc.MvcHtmlString ListBoxFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList);
static member ListBoxFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBoxFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem)) As MvcHtmlString

类型参数

TModel

模型的类型。

TProperty

属性的类型。

参数

htmlHelper
HtmlHelper<TModel>

此方法扩展的 HTML 帮助器实例。

expression
Expression<Func<TModel,TProperty>>

一个表达式,用于标识包含要显示的属性的对象。

selectList
IEnumerable<SelectListItem>

用于填充下拉列表的 对象的集合 SelectListItem

返回

一个由表达式表示的对象中的每个属性所对应的 HTML select 元素。

例外

expression 参数为 null。

适用于

ListBoxFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, IEnumerable<SelectListItem>, Object)

使用指定的列表项和 HTML 属性为由指定表达式表示的对象中的每个属性返回 HTML select 元素。

public static System.Web.Mvc.MvcHtmlString ListBoxFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, object htmlAttributes);
static member ListBoxFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBoxFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), htmlAttributes As Object) As MvcHtmlString

类型参数

TModel

模型的类型。

TProperty

属性的类型。

参数

htmlHelper
HtmlHelper<TModel>

此方法扩展的 HTML 帮助器实例。

expression
Expression<Func<TModel,TProperty>>

一个表达式,用于标识包含要显示的属性的对象。

selectList
IEnumerable<SelectListItem>

用于填充下拉列表的 对象的集合 SelectListItem

htmlAttributes
Object

一个 对象,该对象包含要为 元素设置的 HTML 属性。

返回

一个由表达式表示的对象中的每个属性所对应的 HTML select 元素。

例外

expression 参数为 null。

适用于