@HTML.Checkboxfor does not pass value to the model

Asked

Viewed 90 times

1

I have the following problem: I have a checkbox on the page but even marking it, on controller the Model continues with the field lavagem = false.

Model

public bool lavagem { get; set; }

View

@Html.CheckBoxFor(model => model.lavagem, htmlAttributes: new  { id="chkLavagem" })
  • Could you show the controller method, especially the input parameters? It would also be interesting to show how Ubmit is doing from the view. Just with the code you put in, it’s very hard to imagine what might be going on.

  • if you change bool for String it returns different values?

  • 1

    Can you put in your question the code of Action call on the Controller?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.