Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Bind Exclude more than one property from a model with linq to sql asp.net mvc

I have a form with a select box on it.

The linq entity has a selectList as a public property on it.

I'm currently excluding it from the entity like this

[Bind(Exclude = "taskDeadlineTime")]

I now want to add a second drop down, and I'm getting this error when I try to UpdateModel()

No parameterless constructor defined for this object.

Is it right that I should be adding this new property to the bind exclude list?

If so how do I add more than one property to the list?

like image 684
Chris Barry Avatar asked Jan 21 '23 12:01

Chris Barry


1 Answers

Exclude takes a comma separated list of property names, just add another.

Complete Docs:

http://msdn.microsoft.com/en-us/library/system.web.mvc.bindattribute.aspx

like image 194
John Farrell Avatar answered May 20 '23 15:05

John Farrell