I would love to use the:
Html.EditorFor(model => @Data.Test.Correct)
To create a checkbox.
However the source of my data is different from the data that needs to be updated. I know this may sound confusing but 开发者_StackOverflow社区I get my data from a LINQ select query and then need to update in a different place.
The only way around this seems for me to hand code the HTML for the checkbox. But can someone give me an example of how I do this. For example, how can I code in the setting of checked=true?
You may write HTML codes like below to create a selected or unselected checkbox
<input type="checkbox" name="option1" value="1" checked="checked" />
<input type="checkbox" name="option2" value="2" />
But you will need to write additional code manually to determine which checkbox should be selected, if your checkbox is dynamic generated or being filled in with stored data.
加载中,请稍侯......
精彩评论