I have an MVC project IM which is currently working and I have a view of mine when I check the check box Change, then it passes the right value for my model?
For checkboxes:
@model_boss_moles @Emporial Module @using (HTML.business)) {@ HTML.ValidationSummary (true) & lt; Fieldet & gt; & Lt; Story & gt; EmployeeModel & lt; / Narrative & gt; & Lt; Div class = "editor-label" & gt; @HTMLLabelFor (model = & gt; model .active) & lt; / Div & gt; & Lt; Div class = "editor-field" & gt; @html Checkbox (model = & gt; model .active) @html. Validity message (model = & gt; model. Active) & lt; / Div & gt; & Lt; P & gt; & Lt; Input type = "submit" name = "sub" value = "save" /> & Lt; / P & gt; & Lt; / Fieldset & gt; } Model:
public class employee model {public child active {get; Set; }} When I check or check the check box in the running time, this value never gets passed, it is always false.
Please tell me this is right for MVC.
The code you posted is correct, although you have not posted your controller code. It should look like this:
public action junk () {return view (); } [Hppost] Public Action Result Junk (Employee Model Model) {Bull Beactive = Model. Active; See Return (Model); }
No comments:
Post a Comment