I'm a novice ASP.NET MVC programmer coming from the .NET Desktop world.
In my desktop applications, I auto-generate a lot of UI: create a data model, add some attributes, and off you go.
class Person
{
[TextboxEditor(MaxLength=50)]
public string Name;
[DateEditor]
public DateTime Birthdate;
}
[..]
{
List<Person> list = new List<Person>();
form.AddControl(new GenericEditor(list));
}
For that, I created my own library.
Is there a less cumbersome way in ASP.NET MVC to accomplish the same thing?
I want to put a List<Person>
into it, and it automatically creates a list editor.
Then, I want to be able to configure the behaviour in detail:
- allow / disallow editing based on permissions
- input validation
- Ideally, it should also be possible to insert this list as part of another page. Something like a user control, but in MVC.
I do not want to use code generators, I want the UI to be generated on-the-fly.
Something like:
class PeopleListController: GenericController<List<Person>>
{
public void Init(List<Person> model)
{
base.BindTo(model);
AllowEditing(...);
ConfigureSomeMoreStuff(...);
}
}