views:

40

answers:

1

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?

+1  A: 

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

jfar
This doesn't work, [Bind(Exclude = "taskDeadlineTime", "taskStartTime")]error named attribute argument expected, please can you show me the exact syntax, I have tried quite a few?
optician
[Bind(Exclude = "Prop1, Prop2, Prop3, ...")]
Levi
Yep, thats it, I tried so many different things, grouping strings inside a single literal caught me out. The correct was [Bind(Exclude = "taskDeadlineTime,taskStartTime")]
optician