我想在单击按钮时在浏览器的新选项卡中打开页面。
我在谷歌上搜索了很多,但没有找到任何东西。
这是我的按钮。
<asp:Button ID="btnNewEntry" runat="Server" CssClass="button" Text="New Entry" OnClick="btnNewEntry_Click" />
protected void btnNewEntry_Click(object sender, EventArgs e)
{
Response.Redirect("New.aspx");
}
你能帮我解决这个问题吗?
最佳答案
您可以使用window.open
。像这样:
protected void btnNewEntry_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(
this.GetType(),"OpenWindow","window.open('YourURL','_newtab');",true);
}
关于asp.net - 如何在asp.net中单击按钮在新选项卡中打开页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10493901/