您的位置:首页 > 其它

使用Redirect打开新窗口

2011-02-11 16:06 218 查看
方法一:

/// <summary> /// 使用此方法,可以确保同一个窗口只打开一次 /// </summary> public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.btnRedirect.Attributes.Add("onclick", "this.form.target='_newName'"); } protected void btnRedirect_Click(object sender, EventArgs e) { //this.form1.Target = "_blank"; Response.Redirect("NewPage.aspx"); } }

方法二:

/// <summary> /// 使用此方法,没点击一次就会打开一个窗口 /// </summary> public partial class WebForm2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.form1.Target = "_blank"; } protected void btnRedirect_Click(object sender, EventArgs e) { Response.Redirect("NewPage.aspx"); } }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: