Do it
<input id="@string.Format("presentation.ServiceInfoes[{1}].Locations[{0}].Key", index, Model.Item2)" type="checkbox" @(location.ThirdValue ? "checked" : "") name="@string.Format("presentation.ServiceInfoes[{1}].Locations[{0}].ThirdValue", index, Model.Item2)" />
The value does not check the checkbox or not, the value has a different function. For example, if you set the value to "test" and check the box, when you submit the form, you will see that instead of the true value of the transmitted variable, there will be "test";
You can make pretty cool stuff with it. For example, you have 3 checkboxes in your form. they all have the same name but different meanings. when submitting the form, the result obtained by you will be separated by a comma with the values ββof the checked flags;
source share