mvc html.checkboxfor,InputExtensions.CheckBoxFor Method (System.Web.Mvc.Html) | Microsoft Docs

本文介绍如何在ASP.NET MVC中使用CheckBoxFor方法,为对象的每个属性动态生成HTML复选框元素,包括表达式指定的对象和自定义HTML属性设置。重点讲解方法参数和返回值,以及可能遇到的异常情况。
摘要由CSDN通过智能技术生成

Returns a check box input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.

public static System.Web.Mvc.MvcHtmlString CheckBoxFor (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, System.Collections.Generic.IDictionary htmlAttributes);

static member CheckBoxFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * System.Collections.Generic.IDictionary -> System.Web.Mvc.MvcHtmlString

Public Function CheckBoxFor(Of TModel) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, Boolean)), htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Type Parameters

TModel

The type of the model.

Parameters

The HTML helper instance that this method extends.

expression

An expression that identifies the object that contains the properties to render.

A dictionary that contains the HTML attributes to set for the element.

Returns

An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression, using the specified HTML attributes.

Exceptions

The expression parameter is null.

Applies to

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值