how to pass parameter from @Url.Action to controller function

后端 未结 10 810
一生所求
一生所求 2020-12-02 19:42

I have a function CreatePerson(int id) , I want to pass id from @Url.Action.

Below is the reference code:

pub         


        
10条回答
  •  情书的邮戳
    2020-12-02 20:07

    should you pass it in this way :

    public ActionResult CreatePerson(int id) //controller 
    window.location.href = "@Url.Action("CreatePerson", "Person",new { @id = 1});
    

提交回复
热议问题