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

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

    Try this

    public ActionResult CreatePerson(string Enc)
    
     window.location = '@Url.Action("CreatePerson", "Person", new { Enc = "id", actionType = "Disable" })'.replace("id", id).replace("&", "&");
    

    you will get the id inside the Enc string.

提交回复
热议问题