If i declare the Bind attribute as a parameter on the method, it doesnt work as it expected
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create([Bind(Exclude="ID")]int ServiceId, Event evnt)
{
var service = dbSrc.GetAll().WithI开发者_如何转开发D(ServiceId).SingleOrDefault();
if (service == null)
But if i declare it on the class level, it works!
[Bind(Exclude = "ID")]
partial class Event
{
The form firing the create action is in the usercontrol and i am using asp.net mvc 1 ?
My db setup is fine. The id column is primary key and auto generated.
What might be the reason ? or it s a bug in the version 1.0 ?
Thanks in advance
How about this:
public ActionResult Create(int ServiceId, [Bind(Exclude="ID")]Event evnt)
instead? I'm betting ServiceId
has no ID
property.
精彩评论