@model SepiaCMSClassLib.Model.Page
<table>
@using (Html.BeginForm())
{
<tr>
<td width="300">
@Html.EditorFor(m=>m.pagedetail)
</td>
</tr>
}
</table>
My model
public class Page
{
public int PageID { get; set; }
public int SortId { get; set; }
public List<PagesDetail> pagedetail { get; set; }
}
public class PagesDetail
{
public int PageTitle{ get; set; }
public int PageDescription{ get; set; }
public int LangId{ get; set; }
}
In my action method i am passing nothing to this view as it is the create view
public ActionResult Create()
{
return View();
}
The problem is that my EditorFor()
template is loading when i pass data to it it is loading , it is not loading if i pass no data. i understand that is the default behavior. I wanted to use nested model binding ( only passing page
model in the controller posts). Html.Partial()
will not give the desired result of nested model binding
How can i use EditorFor
template approach in create view?