Using Razor in my mvc web app.
I have this:
@Html.CheckBox(Model.SectionModel[i].PreferenceModel[j].Name,Boolean.Parse( Model.SectionModel[i].PreferenceModel[j].Value ))
so, for me here the initial value of this checkbox is TRUE.
Now, if my User sets it to false I wish to change/create a hidden field to show this value is FALSE for use in my postback.
I cannot use @HTML.CheckBoxFor because the value is coming from a XML file and this value could be for a different control that is not a boolean value.
Following the suggested answer route i put in this:
@Html.EditorFor( x => x.SectionModel[i].PreferenceModel[j].Value, Model.SectionModel[i].PreferenceModel[j].Name)
but the value as the value i string a textbox is rendered and not a checkbox. which is the opoosite to my problem
is null