ASP.NET Button to redirect to another page

后端 未结 4 640
萌比男神i
萌比男神i 2020-12-05 10:08

How do I code the button such that when I click the button and it brings me to another web form? Let\'s say the button name is Confirm and the wed form is confirm.aspx ?

4条回答
  •  生来不讨喜
    2020-12-05 10:38

    You can either do a Response.Redirect("YourPage.aspx"); or a Server.Transfer("YourPage.aspx"); on your button click event. So it's gonna be like the following:

    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        Response.Redirect("YourPage.aspx");
        //or
        Server.Transfer("YourPage.aspx");
    }
    

提交回复
热议问题