Rookie question.
I have a parameter being passed to a create view. I need to set a field name with a default value.
@Html.EditorFor(model => model.Id)
I need to set this input field with name Id with a default value that is being passed to the view via an actionlink.
So, how can this input field –@Html.EditorFor(model => model.Id) — get set with a default value.
Would the following work?? Where the number 5 is a parameter I pass into the text field to set default value.
@Html.EditorFor(c => c.PropertyName, new { text = "5"; })
The clean way to do so is to pass a new instance of the created entity through the controller:
If you want to pass the default value through ActionLink