I have a View like this (unimportant stuff left out):
@model MyProject.Models.Accounts
<div class="editor-label">
@Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
</div>
Now, I have a separate Model I want to use for validation. Is it possible to use both my Model for data AND this validation Model in a View? Something like this:
@model MyProject.Models.Accounts
@validaitonmodel MyProject.Models.AccountValidationModel
<div class="editor-label">
@Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(validationmodel => validationmodel.Name)
</div>
Thanks in advance.
EDIT
By "Model" I mean the models that are automaticly generated by the .edmx (the Ado.net self-tracking entities)
By ValidationModel I mean a custom class like this:
public class AccountValidationModel
{
[Required]
public String Name {get; set;}
}