MVC Html.ActionLink with post functionality?

前端 未结 3 1544
闹比i
闹比i 2021-01-16 02:43

I\'m checking to see if anyone has written an MVC extension for Html.ActionLink that you can pass in Post parameters like such:

<% Html.ActionLink(\"Click         


        
3条回答
  •  难免孤独
    2021-01-16 03:10

    Ajax.ActionLink works perfectly fine for a post request. To refresh page, you can create a function that refreshes page (e.g. function reload(){ windows.location.reload();}). It would look something like this.

    @Ajax.ActionLink("DiaplyName", "Action", new { parameters to post }, new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, OnComplete="reload();"})
    

    Note: You'll need to reference the appropriate scripts to use ajax or jQuery code.

提交回复
热议问题