簡體   English   中英

如何在按鈕上單擊打開兩個彈出窗口?

[英]How to open two popup window on a button click?

我需要在asp.net C#中單擊ona按鈕打開兩個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);

這兩個窗口需要唯一的名稱。 嘗試更改第二個PopupName,看看它是否有幫助。

我通常會這樣做..

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM