2012-12-14 147 views
0

我已經創建一個頁面(creation.aspx)與一個按鈕。在新瀏覽器窗口中打開彈出頁面(pass.aspx)當我單擊按鈕時。還有一些操作是在彈出的窗口中進行的,然後點擊popup中的提交按鈕。但是我有一個疑問。我想將彈出窗口中的值傳遞給父窗口。從彈出窗口傳遞值到父窗口

是否可能。如果可能意味着如何?請幫我解決這個問題。

在父頁面:

<asp:ImageButton ID="img_pass" style="vertical-align:bottom;" runat="server" OnClientClick= "window.open('pass.aspx','','location=0,resizable=0,ScrollBars=1,statusbar=1,width=550,height=550,left=20,top=10,moveable=0') ;return false;" ImageUrl="~/images/bnt_pass.png" Width="20px" Height="20px" /> 

在彈出的窗口中:

Response.Redirect("creation.aspx?id =" + value1.Text + "&" + value.Text); 

回答

1
string redirectUrl = "creation.aspx?id =" + value1.Text + "&" + value.Text; 
ScriptManager.RegisterStartupScript(this, GetType(), "Redirect", "window.parent.location = " + redirectUrl , true); 
+0

值不傳遞到父窗口 – user1804985

0

使用Session變量將值從一個頁面傳遞到另一個頁面。 (ie)在彈出頁面的服務器端事件(buttonclick,dropdownchanged等)中保存您所需的值在Session[""]變量中,並在您的父頁面中使用Session[""]變量。

0

您可以使用以下JavaScript代碼將值返回給父窗口。

功能fnOk() {

top.returnValue = "Data"; 
    window.close(); 
    return true; 

} 
相關問題