How do I redirect a user when a button is clicked?

前端 未结 10 819
情话喂你
情话喂你 2020-12-13 05:30

I have a view with a button. When the user clicks the button I want them redirected to a data entry view. How do I accomplish this? I should mention the views are created, t

10条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 06:32

    Or, if none of the above works then you can use following approach as it worked for me.

    Imagine this is your button

    
    

    I got the value for ${Id} filled using jquery templates. You can use whatever suits your requirement. In the following function, I am setting window.location.href equal to controller name then action name and then finally parameter. I am able to successfully navigate.

    function NavigateToPdf(id) {
        window.location.href = "Link/Pdf/" + id;
    }
    

    I hope it helps.

提交回复
热议问题