I want to perform an Add object scenario in .NET using the modelbinder.
Function AddObject() As ActionResult
Return View()
End Function
<AcceptVerbs(HttpVerbs.Post)> _
Function AddObject(<Bind(Exclude:="ObjectId")> ByVal o As BLL.Object) As ActionResult
o.Save()
End Function
However, I get an error:
'o.ObjectId' is not declared or the module containing it is not loaded in the debugging session.
While inspecting the object, all other fields are set properly. I've tried all combinations regarding:
with/without Html.Hidden("ObjectId")
to with/without <Bind(Exclude:="ObjectId")>
and even setting o.ObjectId
to Nothing
, all with the same results.
What am I doing wrong?