| 1. |
What Are The Differences Between Partial View And Display Template And Edit Templates In Asp.net Mvc? |
|
Answer» Display Templates : These are model centric. Meaning it DEPENDS on the properties of the view model USED. It USES convention that will only display like divs or labels. Edit Templates : These are also model centric but will have editable controls like Textboxes. PARTIAL View : These are view centric. These will differ from templates by the WAY they render the properties (Id's) Eg : CategoryViewModel has Product class property then it will be rendered as Model.Product.ProductName but in case of templates if we CategoryViewModel has List then @Html.DisplayFor(m => m.Products) works and it renders the template for each item of this list. Display Templates : These are model centric. Meaning it depends on the properties of the view model used. It uses convention that will only display like divs or labels. Edit Templates : These are also model centric but will have editable controls like Textboxes. Partial View : These are view centric. These will differ from templates by the way they render the properties (Id's) Eg : CategoryViewModel has Product class property then it will be rendered as Model.Product.ProductName but in case of templates if we CategoryViewModel has List then @Html.DisplayFor(m => m.Products) works and it renders the template for each item of this list. |
|