如何打开在asp.net中一个新标签 [英] How to open a new tab in asp.net

查看:159
本文介绍了如何打开在asp.net中一个新标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在新标签打开一个aspx页面,我搜索型动物的解决方案,但我只发现了codeS打开弹出窗口和浏览器拦截。我需要做的是在背后

I need to open an aspx page in a new tab, I searched differents solutions, but I've only found codes that open pop-ups and the browser blocks. I need to do it in the code behind

我希望有人帮助我,谢谢。

I hope somebody help me, THANKS.

推荐答案

您无法打开从code了新的一页的后面。相反,你需要在客户端打开。

You cannot open a new page from code behind. Instead, you need to open at client side.

protected void Button1_Click(object sender, EventArgs e)
{
    string url = "http://www.stackoverflow.com";
    string script = string.Format("window.open('{0}');", url);

    Page.ClientScript.RegisterStartupScript(this.GetType(), 
        "newPage" + UniqueID, script, true);

    /* Use this if post back is via Ajax
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), 
        "newPage" + UniqueID, script, true); */
}

开在客户端的问题是有时弹出窗口阻止程序块的页面。

The problem of opening at client side is sometime pop-up blocker blocks the page.

这篇关于如何打开在asp.net中一个新标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆