Window.Open在Updatepanel中不起作用 [英] Window.Open not working in Updatepanel

查看:87
本文介绍了Window.Open在Updatepanel中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为每个已选中复选框的记录打开新窗口.此aspx页位于更新"面板中.请检查以下代码,该代码适用于选中该复选框的第一条记录,但不会打开选中该复选框的下一条记录的窗口.

I want to open the new window for each record which the check box is checked. This aspx page is inside the Update panel.Please check the following code, this code works for the first record which the check box is checked, but won''t open the window for the next records which the check box is checked.

foreach (DataGridItem item in dgDuration.Items)
{
    CheckBox chkBox = (CheckBox)item.FindControl("cbstrChild");

    if (chkBox.Checked)
    {
        string script = "window.open('Report.aspx?Id=2&Cont=" + item.Cells[0].Text.Trim() + "', '');";
        Page page = HttpContext.Current.Handler as Page;
        if (page != null)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "NewWindow", script, true);
        }

    }
}



[edit]添加了代码块[/edit]



[edit]code block added[/edit]

推荐答案

您无需更改注册脚本的密钥.我想它只注册了一次.
You do not change key of script for registering. I guess it is registering just once.
ScriptManager.RegisterStartupScript(this, this.GetType(), "NewWindow"+i.ToString(), script, true);
++i;


这篇关于Window.Open在Updatepanel中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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