直接導到別頁的方式:Response.Redirect("網址");
以另開新頁的導頁方式:
public static void OpenWindowToNewPage(Page page, string destUrl)
{
//開一新視窗
string scriptString = string.Format("< language="'JavaScript'">window.open(\"{0}\",'NewPage');<", destUrl);
以另開新頁的導頁方式:
public static void OpenWindowToNewPage(Page page, string destUrl)
{
//開一新視窗
string scriptString = string.Format("< language="'JavaScript'">window.open(\"{0}\",'NewPage');<", destUrl);
scriptString += "/";
scriptString += "script >";
Type cstype = page.GetType();
if (!page.ClientScript.IsStartupScriptRegistered("Startup"))
{
page.ClientScript.RegisterStartupScript(cstype, "Startup", scriptString);
}
}
使用方式: OpenWindowToNewPage(this.Page, "網址");
Type cstype = page.GetType();
if (!page.ClientScript.IsStartupScriptRegistered("Startup"))
{
page.ClientScript.RegisterStartupScript(cstype, "Startup", scriptString);
}
}
使用方式: OpenWindowToNewPage(this.Page, "網址");
感謝Darren提供
沒有留言:
張貼留言