MVC Ajax.ActionLink doesn't find POST method

前端 未结 4 1291
终归单人心
终归单人心 2021-02-05 16:17

I have a POST method declared in my controller:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateComments(int id, string comments)
{
    // ... 
}
         


        
4条回答
  •  无人共我
    2021-02-05 16:36

    FormCollection has a default binder associated with it which always initializes the collection and you should never get null. It is more likely that you have an empty collection when using Ajax.ActionLink in contrast to when using a form submit button. This is because the ActionLink method doesn't POST any form values when it performs the AJAX request. This post is the unswer to you question

提交回复
热议问题