Binding from View to Controller does not work in "disabled" fields [duplicate]

0

I use the asp-for property in the elements of my View to pass their values to Controller at time of post of the page.

<input id="txtExamNumber" asp-for="ExamNumber" class="form-control" />

What I noticed is that if I disable the field ( disabled ) through javascript , the binding to Controller no longer works. In hidden fields, for example, works perfectly.

What is the explanation for this behavior? Is there a way around?

    
asked by anonymous 23.08.2017 / 19:52

1 answer

1

This is an expected behavior by the HTML form, it does not send the disabled fields, because in theory, whoever configured them does not need them on the server.

You can override disabled by readonly. link

    
23.08.2017 / 19:57