简体   繁体   中英

MVC 3 C#: HTML.Checkbox usage

I have been searching the posts on the HTML.Checkbox, but I still find that I'm not understanding what I need to do to implement this control. My goal is to provide a test as to whether or not certain controls on a form were filled out; if so, I want to send "true" back within a FormsCollection to some back-end processing in another class that performs some processing based on the value of the control.

I was thinking that I might set the value of the 'hidden' HTML.Checkbox control (true/false) based on the inputs on the form.

Does this this sound like the correct use of this control? Thanks in advance!.

在控制器中,您需要使用[Httppost]和Form Collection并获取复选框值,并将其保留在视图数据或View bag中,并通过其他方式将其传递给视图,否则您必须在会话中保留该复选框中的值并在控制器的整个页面中使用您的应用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM