简体   繁体   中英

How to open two popup window on a button click?

I need to open two pdf files as popup window on click ona button in asp.net C#,but now its opening only the first popup?Can anybody help me ,to open the both windows at the same time?

This is my code:

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);

The two windows need unique names. Try changing the second PopupName and see if it helps.

I would usually do..

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM