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

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

问题描述

我如何code中的按钮,这样当我点击按钮,它带给我到另一个网页的形式?比方说,该按钮的名称是确认和结婚形式是confirm.aspx?

 保护无效btnConfirm_Click(对象发件人,EventArgs的发送)
    {
        (猜测应该有一个输入这里)
    }


解决方案

您既可以做一个的Response.Redirect(YourPage.aspx); Server.Transfer的(YourPage.aspx); 你的按钮的单击事件。
因此,它会是这样的:

 保护无效btnConfirm_Click(对象发件人,EventArgs的发送)
{
    的Response.Redirect(YourPage.aspx);
    //要么
    Server.Transfer的(YourPage.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)
    }

解决方案

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天全站免登陆