How to get values from Child window to parent window

Sometimes we have a simple problem and we think its really very complex and leave it. But listen its wrong attitude. We have to solve each and every problem which are comming in our life. I face a problem that I was unable to get the values from child(Popup) window to parent window. what we need to do for setting values from child window(PopUp window/Dialog) to parent window’s control(textbox). Just required to add the following javascript where we required to add the values from child to parent windows control.

I am here inserting a value in parent windows TextBox named txtTo from my child windows(PopUp dialog’s) TextBox values.

Dim strScript As String = “window.opener.document.getElementById(‘txtTo’).value='” & str.ToString() & “‘;”
strScript &= “this.close();”
Response.Write(strScript)

This will get the value of txtPopUpTitle textbox and set it in the txtTo.

Regards,
Vijay Modi

Advertisements

About Vijay Modi

Having 12+ years of experience in web application development. Expertise in various domains like E-Commerce, E-Learning, Insurance. I have expertise in web application development, window application development, Performance improvement, bug fixing etc. I have worked on various Microsoft technologies including ASP.Net, MVC, WebApi, WCF, Entity Framework, WPF, Window Application Development, AWS, Azure, AngularJS 2.0 / 1.5.2, .NetCore framework, jQuery. I am believing in quality work and achieving deadlines. Also like to work on new technologies and quick learner.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

3 Responses to How to get values from Child window to parent window

  1. Piyush says:

    Dear sir,
    here u use popup through that we can get value from popup to main page.
    this java script really vary easy but i tried to do diffrently but i cant solve my popup problem finally i use your article and problem gets gone.
    thanks you and keep continue putting this type of genaral problem facing accross Devlope.
    Thnk u vary much
    Piyush Khatri
    Asp.Net Developer

  2. jithu says:

    Hi,

    Your code works perfectly in a normal scenario.
    Can you tell me how to do the same when using STRUTS???

    Thanks and Regards,
    Jithinraj

  3. Vijay Modi says:

    Jithinraj,

    I don’t getting your question.

    Can you tell me how to do the same when using STRUTS???

    Can you pls give me detail.

    Regards,
    Vijay Modi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s