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

后端 未结 10 807
一生所求
一生所求 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:13

    Try this:

    public ActionResult CreatePerson(int id) //controller 
    
    window.location.href = "@Url.Action("CreatePerson", "Person")?Id='+Id+'";
    

    it's working fine passing parameter.

提交回复
热议问题