2011-12-12 84 views
0

我試圖從代碼中打開一個新頁面。爲此,我使用的按鈕單擊事件頁面在後臺嘗試使用後面的代碼打開新頁面

string pageURL = UIConstants.Url.PrintUserBRCs + "?" + UIConstants.ReportType + "=" + UIConstants.DetailReport; 

string script = string.Format("window.open('{0}', null, 'height=600, width=800, status=yes, location=yes, menubar=yes, resizable=yes, scrollbars=yes, status=yes, toolbar=yes, titlebar=yes')", pageURL); 

Page.ClientScript.RegisterClientScriptBlock(GetType(), "LaunchTemplate", script, true); 

新頁面中正常打開,但是它有一個新的頁面進入後臺的問題,而舊的頁面出現在頂部下面的代碼。

我需要顯示在上一頁頂部打開的新頁面。 我該怎麼做。

在此先感謝。

回答

2

您可以使用focus()這樣的:

string script = string.Format("var newWindow = window.open('{0}', null, 'height=600, width=800, status=yes, location=yes, menubar=yes, resizable=yes, scrollbars=yes, status=yes, toolbar=yes, titlebar=yes');" 
             + " newWindow.focus();", pageURL); 
相關問題