簡體   English   中英

如何在ASP.NET中使用C#刷新當前窗口

[英]how to refresh the current window using c# in asp.net

if (TextBox1.Text == row["UserName"].ToString() 
    && TextBox2.Text == row["Password"].ToString())
{   
    //here i have to reload the page
    Button1.Attributes.Add("onclick", "alert('Login SucessFull')");
    break;
}

也許這更是您想要的? 它將顯示警報,然后將您重定向到另一個頁面。

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "LoggedInScript", "alert('Login SucessFull'); window.location = 'MyLoggedInPage.aspx';", true);

當您說您需要“重新加載頁面”時,是否意味着由於用戶現在已登錄而重定向到另一個頁面? 如果您使用:

Response.Redirect("MyLoggedInPage.aspx")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM