It is possibly a mistake in my syntax, but I have been unable to set a default value for my EditorFor
in my view using ViewBag
.
I have checked that the value in the ViewBag.FirstName
is being passed through correctly, it is fine. However, the field displays with no value.
My statement is:
@Html.EditorFor(model => model.Person.FirstName, new { htmlAttributes = new { @class = "form-control" } , @Value = ViewBag.FirstName })
Any help would be greatly appreciated.
Apologies for the simplicity of my question.
ViewBag
property) – Lynnalynne