finance_teacher
asked on
ASP.Net MVC 4 C# -- Html.EditorFor Set Default Value
I added the below , new object { @Value = "test" to my Create.cshtml, tested, and got an error.
How can I fix ?
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --
<div class="editor-label">
@Html.LabelFor(model => model.PartDescription)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PartDescription, new object { @Value = "test" })
@Html.ValidationMessageFor (model => model.PartDescription)
</div>
How can I fix ?
--------------------------
<div class="editor-label">
@Html.LabelFor(model => model.PartDescription)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PartDescription, new object { @Value = "test" })
@Html.ValidationMessageFor
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.