I am currently creating an application which references a database using EF in MVC 3. I have used the scaffolding read/write data and want to be able to allow some editing to be done on database entries, but not all fields. Is there a way of blocking a user from editing some fields on the edit form and therefore the database?
Since my initial question I attempted to limit the edit functionality by changing
<div class="editor-label">
@Html.LabelFor(model => model.Clause)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Clause)
@Html.ValidationMessageFor(model => model.Clause)
</div>
to use the
<div class="editor-label">
@Html.LabelFor(model => model.Clause)
</div>
<div class="editor-field">
@Html.DisplayFor(model => model.Clause)
</div>
However when actually saving the edit, the fields which reference the DisplayFor field come out blank. Is there any better way of doing this so it does not occur?
Many thanks,
Chri3