FormFactory
FormFactory copied to clipboard
How to add editable collection in Programatically created form?
Thanks for provided so great library, just has a question, how to add editable collection in Programatically created form?
Something like:
var formModel = new[]
{
new PropertyVm(typeof(List<Movie>) , "movies")
{
DisplayName = "Movies",
NotOptional =true,
Value = new List<Movie>()
{
new Movie() {Title = "Fight Club"},
new Movie() {Title = "The Silent Partner" },
new Movie() {Title = "Bambi"},
}
},
};
...
public class Movie
{
[Required]
[StringLength(64, MinimumLength = 2)]
public string Title { get; set; }
}
It's a bit more complex if you want to have a list of programatically created types, rather than a static type (like Movie).
Thanks for you quick reply @mcintyre321. I'd like build a form builder and user want to add some collection data. It seems the item type like Movie should be static type, not sure how to do it dynamically. thanks.
Did the above work for you?