问题
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.
来源:https://stackoverflow.com/questions/8587893/bind-exclude-not-working-model-binding-for-child-objects-in-asp-net-mvc