I would like to return an EditorTemplate from my controller as a Partial View.
I am currently doing:
public ActionResult Create([Bind(Prefix="Create")]CreateViewModel model)
{
return PartialView("~/Views/Shared/EditorTemplates/Template.cshtml", model);
}
The problem is that after I do this the Create_
prefix goes away from my view. Is there a way to return an editor template as a partial view and retain the prefix?
Index.cshtml @model IndexViewModel
@using(Html.BeginForm("Create"))
{
@Html.EditorFor(m => m.Create, "Template")
<input type="submit" value="Save" />
}
I am submitting this form with an AJAX call. When I originally call EditorFor, all of the fields have a prefix of Create_
. However, after I submit the form and return this PartialView, the prefix is lost.