如何在按钮上单击打开两个弹出窗口?

时间:2012-07-18 05:54:31

标签: c#

我需要在asp.net C#中点击一个按钮打开两个pdf文件作为弹出窗口,但现在只打开第一个弹出窗口?有人可以帮我,同时打开这两个窗口吗?

这是我的代码:

string PDFPath = folderpath + filename;
                string PopupName = "popUp";
                string PopupSettings = "height=900,width=1000,top=100,left=100,scrollbars=no,resizable=no,toolbar=no,menubar=no,location=no,status=yes";
                string NewPath = "var popup=window.open('../PopupForReport.aspx?pdfPath="
                    + PDFPath.Replace("\\", "/") + "','" + PopupName + "','" + PopupSettings + "')";
ScriptManager.RegisterStartupScript(updatePanel1, updatePanel1.GetType(), "popupOpener", NewPath, true);



string PDFPath1 = folderpath + filename1;
                string PopupName = "popUp";
                string PopupSettings = "height=900,width=1000,top=100,left=100,scrollbars=no,resizable=no,toolbar=no,menubar=no,location=no,status=yes";
                string NewPath1 = "var popup=window.open('../PopupForReport.aspx?pdfPath="
                    + PDFPath1.Replace("\\", "/") + "','" + PopupName + "','" + PopupSettings + "')";
ScriptManager.RegisterStartupScript(updatePanel1, updatePanel1.GetType(), "popupOpener", NewPath1, true);

2 个答案:

答案 0 :(得分:2)

这两个窗口需要唯一的名称。尝试更改第二个PopupName,看看它是否有帮助。

答案 1 :(得分:0)

我通常会这样做..

string PDFPath = folderpath + filename;
string wndName = "Window" + DateTime.Now;

//this would make the window name unique
.
.
.