MVC template from folder other than default (EditorTemplates/DisplayTemplates)?

No, I am afraid you can’t do this.

For example, if I have an editor template under this folder

That’s no longer an editor template. It’s a partial. If you want to share editor templates between different controllers you can simply put them inside the ~/Views/Shared/EditorTemplates folder.

As far as subfolders are concerned then you could do this:

@Html.EditorFor(x => x.Foo, "Order/ProductModel")

which will render the ~/Views/CurrentController/EditorTemplates/Order/ProductModel.cshtml or ~/Views/Shared/EditorTemplates/Order/ProductModel.cshtml editor template.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)