为的FormCollection复选框 [英] FormCollection for a checkbox
本文介绍了为的FormCollection复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的FormCollection正在恢复回来复选框,但我的价值后,
My FormCollection is returning back a Checkbox, but I am after the value
collection["SelectedCheckbox"]
这将返回真,假
但我想要的结果,应该是真或假
but I want the results, which should be either true or false
推荐答案
在asp.net MVC的,你就必须检查假
,您检查错误的原因因为 HTML复选框
助手就是某种奇特的事情值真正
in asp.net-mvc you would have to check for false
, the reason you check for false because the Html Checkbox
helper does some kind of freaky thing for value true
真正的收益为:
这让字符串读真,假
所以你可能会以为这是两个值,但其只是一个手段和真正的
so you may have thought it was two values but its just one and means true
假回报为:
它使读取字符串假
这篇关于为的FormCollection复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文