HTML.HiddenFor value set
For setting value in hidden field do in the following way: @Html.HiddenFor(model => model.title, new { id= “natureOfVisitField”, Value = @Model.title}) It will work
For setting value in hidden field do in the following way: @Html.HiddenFor(model => model.title, new { id= “natureOfVisitField”, Value = @Model.title}) It will work
Most of the MVC helper methods have a XXXFor variant. They are intended to be used in conjunction with a concrete model class. The idea is to allow the helper to derive the appropriate “name” attribute for the form-input control based on the property you specify in the lambda. This means that you get to … Read more
It creates a hidden input on the form for the field (from your model) that you pass it. It is useful for fields in your Model/ViewModel that you need to persist on the page and have passed back when another call is made but shouldn’t be seen by the user. Consider the following ViewModel class: … Read more
That’s normal and it is how HTML helpers work. They first use the value of the POST request and after that the value in the model. This means that even if you modify the value of the model in your controller action if there is the same variable in the POST request your modification will … Read more