ASP.NET 按钮重定向到另一个页面 [英] ASP.NET Button to redirect to another page

查看:27
本文介绍了ASP.NET 按钮重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何对按钮进行编码,以便当我单击该按钮时它会将我带到另一个 Web 表单?假设按钮名称是 Confirm 并且星期三表单是 confirm.aspx ?

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 ?

    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        (guessing that there should be an input here)
    }

推荐答案

您可以执行 Response.Redirect("YourPage.aspx");Server.Transfer("YourPage.aspx"); 在你的按钮点击事件上.所以它会像下面这样:

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");
}

这篇关于ASP.NET 按钮重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆