开发者

Model value not set when passing into View in ASP.NET MVC2

Stumped...

I have a few routes set up:

    Function AddUpdate(ByVal id As Long) As ActionResult
        Return View(New UPDATES With {.ID = id})
    End Function

    <HttpPost()> _
    Function AddUpdate(ByVal Update As UPDATES) As ActionResult
       //Do cool posted stuff here
    End Function

The type of the .ID is LONG.

When it runs the post function, the Update object's Update.ID is nothin开发者_StackOverflow中文版g.

My view doesn't alter the property, and I don't have any Helper methods attached to it in the view. Shouldn't it be sent back through to the post method?

Thanks - JB


Is The id being sent back in the HTTP Post (using fiddler or firebug to see)?


Are you actually passing the value back with POST, either through your route, or a form field? The ModelBinder can't bind values if it doesn't know where to look for them...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜