我正尝试使用按钮在ASP.NET中的新选项卡中打开链接。我尝试以下,但它不工作:在ASP.NET的新选项卡中打开链接
<asp:Button ID="ReportButton" runat="server" CssClass="button" Font-Size="XX-Large" ForeColor="White" Text="Report" OnClick="ReportButton_Click" OnClientClick="form1.target='_blank';" />
在代码中,ReportButton_Click
定义如下:
protected void SkidPackReportButton_Click(object sender, EventArgs e)
{
GoToPage(LocationSkidPackReportPage);
}
和GoToPage
定义如下:
bool GoToPage(string page)
{
try
{
Response.Redirect(page);
return true;
}
catch (Exception)
{
StatusLabel.Text = "There was an error finding the page.";
return false;
}
}
您不能回发到服务器并打开新的选项卡/窗口。浏览器的弹出式窗口拦截器会阻止窗口。你想达到什么目的? – Win
显示的错误是什么? –
没有错误。 – muttley91