Mvc3 IEnumerable<QuestionModel> have a List<QuestionOptionModel> property. When I post, I get null list

Posted by user1649439 on Stack Overflow See other posts from Stack Overflow or by user1649439
Published on 2012-09-05T15:33:15Z Indexed on 2012/09/05 15:38 UTC
Read the original article Hit count: 154

Filed under:
|
|
|

There is a example here. I am trying to use this technique in a large form with a list(List) but when I post back, the Viewmodel.Order that should’ve contained list of items and activities return with the lists empty.

My QuestionModel.cs like this.

 public int Id { get; set; }       
 public string QuestionText { get; set; }     
 public System.Nullable<bool> OptionType1 { get; set; }
 public System.Nullable<bool> OptionType2 { get; set; }
 public List<QuestionOptionModel> OptionList = new List<QuestionOptionModel>();

When I post back "IEnumerable questions" List OptionList comes null. How can I do this?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-3

Related posts about list