2

I got into a issue in Model Binding in Asp.Net MVC. I have view model like below,

public class ArticleViewModel : BaseViewModel
    {        
        public Article art { get; set; }
        public List<ArticleAttachment> attachments { get; set; }
    }

I am trying to exclude model binding a property on the "Article" child object as seen below in my action method,

[HttpPost]
[ValidateInput(false)]
public ActionResult New([Bind(Exclude = "art.Abstract")]ArticleViewModel articleVM)
 {

But the model binder populates the property called Abstract even with the above setting.

Please let me know if i am doing anything wrong. I need to exclude some of the properties in the Article child object when doing Model binding.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Bala
  • 333
  • 1
  • 5
  • 13

0 Answers0