I have the following Razor code:
<td>
<div class="editor-label">
@Html.LabelFor(model => model.AccountCode)
</div>
</td>
<td>
<div class="editor-field">
@Html.EditorFor(model => model.AccountCode)
</div>
</td>
I would like to hard code the value 1001 as a default for the Input field. I have tried [model.accountcode ="1001"] which does not work.
Please explain with example code.
If you want to set a value in the model, that should be done in the controller…
Then use the normal syntax in Razor:
Or if you just want a hidden parameter: