Question

I am faced with a style difficulty, I am currently building a site with the asp mvc framework. I am a big fan of the html.EditorFor option in the templates that generates a realy nice form for me. Because I really hate programming all the input fields myself. However I does not work as well with composite classes. If I have a class like:

public class person{
  public Address address { get; set; }
  public Name    name   { get; set; }
}

public class Address{
  public string street { get; set; }
  public string zipcode { get; set; }
  ....
}
public class Name{
  ....
}

I would like the EditorFor function to generate a nice registration form asking for the name and address data however I seem to need to make a editortemplate for every class then. Which is nasty if i ever decide to change the class.

There for I am asking you. Is there a nice way to make this work? What setting do I need to make EditorFor generate the proper form without needing to make a template for every form myself?

Again I don't mind it to much that i need to create those forms I would just rather have the system do that kind of stuff for me so that I can easily manipulate classes

Was it helpful?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top