Retreive values from PopUp


P

Peter

Does any one has an example of how do I retrieve values from a PopUp Window. The popup windows is an ASP.NET webform and it is displayed when user clicks on a html button.


How do I retrieve the values from the popup window into the parent window (I would like to do something with the data after the OK button is clicked on the popup window)


Here's the code for popup.

OpenPopUp(someWebContol, "MyPopup.aspx?textbox=" + myControl.ClientID, "test", 300, 225);

private void OpenPopUp(System.Web.UI.WebControls.WebControl opener, string pagePath, string windowName, int width, int height)
{
string clientScript = string.Empty;
string windowAttribs = string.Empty;
// Building Client side window attributes with width and height.
// Also the the window will be positioned to the middle of the screen
windowAttribs = "width=" + width.ToString() + "px,height=" + height.ToString() +
"px,left='+((screen.width -" + width.ToString() +
") / 2)+',top='+ (screen.height - " + height.ToString() + ") / 2+'";

//Building the client script- window.open, with additional parameters
clientScript = "window.open('" + pagePath + "','" + windowName + "','" + windowAttribs + "');return false;";
//regiter the script to the clientside click event of the 'opener' control
opener.Attributes.Add("onClick", clientScript);
}


Thanks


Peter
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top