Asp.net

ASP.NET 按鈕重定向到另一個頁面

  • June 1, 2014

如何對按鈕進行編碼,以便當我點擊該按鈕時,它會將我帶到另一個 Web 表單?假設按鈕名稱是 Confirm 並且 wed 表單是 confirm.aspx ?

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

您可以在按鈕點擊事件上執行 aResponse.Redirect("YourPage.aspx");或 a 。Server.Transfer("YourPage.aspx");所以它會像下面這樣:

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

引用自:https://stackoverflow.com/questions/23976683