user1500633
user1500633

Reputation:

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

Upvotes: 0

Views: 2168

Answers (2)

Robin Maben
Robin Maben

Reputation: 23114

I would usually do..

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

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

Upvotes: 0

Smetad Anarkist
Smetad Anarkist

Reputation: 898

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

Upvotes: 2

Related Questions