user1804985
user1804985

Reputation: 297

passing values from popup window to parent window

I have create a page(creation.aspx) with a button. A popup page(pass.aspx) open in a new browser window When i click the button . And some operation made in a popup window and then click submit button in the popup.But i have one doubt. I want to transfer the values from popup window to parent window.

Whether it is possible or not. If it's possible means How?. Please help me to fix this issue.

In parent page:

<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" />

In popup window:

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

Upvotes: 0

Views: 4379

Answers (3)

Raghav
Raghav

Reputation: 9

You can use following javascript code to return the value to parent window.

function fnOk() {

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

}

Upvotes: 0

viki
viki

Reputation: 1178

Use Session variables to pass the value from one page to another. (ie) Save your required values in Session[""] variables in server side events(buttonclick, dropdownchanged etc) in popup page and make use of the Session[""] variables in your parent page.

Upvotes: 0

Manibhadra
Manibhadra

Reputation: 400

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

Upvotes: 1

Related Questions