JavaScript - Maintaining data between Parent-child controls

Asked By SP on 09-Jun-17 03:33 PM
Hi Guys,

Sorry I'm trying to upload an image to explain the scenario, but I'm not able to upload it. Uploader is not working.

I've a scenario as bellow.

1. Parent page with gridview in it.
2. Add new template button, which opens a popup with some txt fields and FileUpload control.
3. On "Submit/Upload" button, I want the data to be stored in javascript and close the popup. The stored data will be accessed from parent page and it will be added to bind the gridview.
I have to add multiple items in gridview, without saving them to db.
4. There is a save button below Gridview. On hitting the save button, I will have to store the data in database after the validation check is done.

Can anyone please suggest how can I do this using javascript or jQuery?

Thanks.
Robbe Morris replied to SP on 10-Jun-17 05:49 PM
The pop up dialog/modal dialog needs to call the parent page in this scenario.  You would use window.opener from JavaScript in the pop up dialog to get a reference to the "window" object of the parent page.  From there, you can access the DOM of the parent page to call JavaScript functions or set element values in the parent page before performing a window.close() from within the dialog.