asp.net - Create multiple parts of complex model in the main view -
i'm little new asp.net mvc, have complex model.
public class buildingpermit { public int applicationid { get; set; } public virtual person applicant { get; set; } public virtual area applicantarea { get; set; } public virtual icollection<owner> owners { get; set; } /... } using scaffolding, created controller , views. however, want register details in same page, meaning in buildingpermit's create view, creating details applicant of type person, applicationarea of type area , on. there way can accomplish this?
if it's not possible, think it's possible add link create object. when user clicks on it, page goes view, creates it, information , shows in buildingpermit's view.
i'd appreciate help.
you achieve creating editor template person, area, owner etc in:
~/views/shared/editortemplates/person.cshtml ~/views/shared/editortemplates/area.cshtml ~/views/shared/editortemplates/owner.cshtml the editor template want typed , should give editor layout type:
@model models.person <h2>person</h2> <p> @html.labelfor(model => model.name) @html.editorfor(model => model.name) </p> <p> @html.labelfor(model => model.address) @html.editorfor(model => model.address) </p> // , on once you've done calling @html.editorfor(model => model.applicant) pick template , display within edit view.
if wanting display of information want create display templates these types. these work editor templates except keep templates in displaytemplates folder.
~/views/shared/displaytemplates/person.cshtml ~/views/shared/displaytemplates/area.cshtml ~/views/shared/displaytemplates/owner.cshtml
Comments
Post a Comment