FormCollection for checkbox

My FormCollection returns a checkbox, but after the value

collection["SelectedCheckbox"]

this returns "true, false"

but I need results that must be either true or false

+3
source share
1 answer

in asp.net-mvc you will need to check the falsereason why you are checking false because the helper is Html Checkboxdoing some fancy thing for the valuetrue

True returns as:

it makes the string read "true, false"

so you might have thought that these are two values, but only one, and means true

False returns as:

it makes the string read "false"

+6
source

Source: https://habr.com/ru/post/1722573/


All Articles