Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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]code block added[/edit]
Posted
Updated 13-Nov-12 23:01pm
v2

1 solution

You do not change key of script for registering. I guess it is registering just once.
C#
ScriptManager.RegisterStartupScript(this, this.GetType(), "NewWindow"+i.ToString(), script, true);
++i;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900