如何在动态URL新标签中打开新窗口 [英] how to open new window in new tab with dynamic url

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

问题描述

我有下拉列表的页面,我必须打开一个新的窗口中选择ITEAM的编辑形式

i have a page with drop down list and i have to open a new window with selected iteam's edit form

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    this.EntityGrid.Columns.Clear();
    EntityName.Text = DropDownList1.SelectedItem.Text;
    newEntity.Visible = true;
    newEntity.Text = DropDownList1.SelectedItem.Text;
    ...
}

以下作品

protected void newEntity_Click(object sender, EventArgs e)
{
    var entity = newEntity.Text;
    Response.Redirect(entity + "Edit.aspx");
    ...
}

但我怎么能在单独的选项卡中打开没有新的窗口。

but how can i open in separate tab not new window.

推荐答案

打开一个单独的窗口是一个客户端的功能,所以你需要注入,告诉浏览器的JavaScript来做到这一点。

Open a separate window is a client feature, so you need to "inject" the javascript that tells the browser to do this.

Response.Write(
     string.Format(
        "<script>window.open('{0}','_blank');</script>", entity + "Edit.aspx"));

参数 _blank 通知 windows.open 函数打开一个新窗口

The parameter _blank tells the windows.open function to open a new window

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

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