How do I insert text into a textbox after popping up another window to request information?

By : Guy
Source: Stackoverflow.com
Question!

I have an asp.net web page written in C#.
Using some javascript I popup another .aspx page which has a few controls that are filled in and from which I create a small snippet of text.
When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "popped up" the dialog/popup page.

I'm guessing that this will involve javascript which is not a strong point of mine.

How do I do this?

By : Guy


Answers

What you could do is create an ajax modal pop-up instead of a new window. The semantic and aesthetic value is greater not to mention the data-passing is much easier.

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx



You will have to do something like:

parent.opener.document.getElemenyById('ParentTextBox').value = "New Text";


This video can help you solving your question :)
By: admin