Close pop-up and postback

G

Guest

Hello

I'm trying to use a pop-up to capture some information and then return the
user to a datagrid containing the changes made in the pop-up.

I have the database update working and the pop-up opens and closes correctly
but I need to find a way to cause the datagrid to refresh once the pop up
closes. How can I force a postback once the pop-up closes?

Thank you
 
G

Guest

You will need to get the handle of the Parent Window and call
Forms[0].Submit(); from the popup.

I think the syntax is
self.opener.window.document.forms[0].submit();
 
G

Guest

I saw another source with similar advice but am having trouble with it
I have the following code in a sub in the codebehind of my pop up window.

Dim strUpdate As String = "<script language='Javascript'>Update
=self.opener.window.document.forms(0).submit();</script>"
Page.RegisterClientScriptBlock("Update", strUpdate)

I don't get any errors but the original page doesn't update either

Sreejith Ram said:
You will need to get the handle of the Parent Window and call
Forms[0].Submit(); from the popup.

I think the syntax is
self.opener.window.document.forms[0].submit();



Mardy said:
Hello

I'm trying to use a pop-up to capture some information and then return the
user to a datagrid containing the changes made in the pop-up.

I have the database update working and the pop-up opens and closes correctly
but I need to find a way to cause the datagrid to refresh once the pop up
closes. How can I force a postback once the pop-up closes?

Thank you
 
G

Guest

It could be few different reasons for it to not working

self.opener.window.document.forms(0).submit() will work only if you are
opening the pop up with winodw.open command. if it is a ModalDialog
,self.opener will be null..

If you have any Frames/Iframes in Parent window , opener.window.document
will rfer to the document in the frame.. you may need the reference to the
document with form in it.

To test if reference is correct , try placing a simple HTML Button in the
popup and call this self.opener.window.document.forms(0).submit() onclick of
it.


Mardy said:
I saw another source with similar advice but am having trouble with it
I have the following code in a sub in the codebehind of my pop up window.

Dim strUpdate As String = "<script language='Javascript'>Update
=self.opener.window.document.forms(0).submit();</script>"
Page.RegisterClientScriptBlock("Update", strUpdate)

I don't get any errors but the original page doesn't update either

Sreejith Ram said:
You will need to get the handle of the Parent Window and call
Forms[0].Submit(); from the popup.

I think the syntax is
self.opener.window.document.forms[0].submit();



Mardy said:
Hello

I'm trying to use a pop-up to capture some information and then return the
user to a datagrid containing the changes made in the pop-up.

I have the database update working and the pop-up opens and closes correctly
but I need to find a way to cause the datagrid to refresh once the pop up
closes. How can I force a postback once the pop-up closes?

Thank you
 
G

Guest

Sreejith Ram said:
It could be few different reasons for it to not working

self.opener.window.document.forms(0).submit() will work only if you are
opening the pop up with winodw.open command. if it is a ModalDialog
,self.opener will be null..

If you have any Frames/Iframes in Parent window , opener.window.document
will rfer to the document in the frame.. you may need the reference to the
document with form in it.

To test if reference is correct , try placing a simple HTML Button in the
popup and call this self.opener.window.document.forms(0).submit() onclick of
it.


Mardy said:
I saw another source with similar advice but am having trouble with it
I have the following code in a sub in the codebehind of my pop up window.

Dim strUpdate As String = "<script language='Javascript'>Update
=self.opener.window.document.forms(0).submit();</script>"
Page.RegisterClientScriptBlock("Update", strUpdate)

I don't get any errors but the original page doesn't update either

Sreejith Ram said:
You will need to get the handle of the Parent Window and call
Forms[0].Submit(); from the popup.

I think the syntax is
self.opener.window.document.forms[0].submit();



:

Hello

I'm trying to use a pop-up to capture some information and then return the
user to a datagrid containing the changes made in the pop-up.

I have the database update working and the pop-up opens and closes correctly
but I need to find a way to cause the datagrid to refresh once the pop up
closes. How can I force a postback once the pop-up closes?

Thank you
 
G

Guest

I am using window.open
no frames
I stumbled across this change and it does the job...I added this to
window.close script.

+"opener.location='parentPage.aspx';self.close()

By reloading the page I get what I need.

The button test did not work.

Thanks

Sreejith Ram said:
It could be few different reasons for it to not working

self.opener.window.document.forms(0).submit() will work only if you are
opening the pop up with winodw.open command. if it is a ModalDialog
,self.opener will be null..

If you have any Frames/Iframes in Parent window , opener.window.document
will rfer to the document in the frame.. you may need the reference to the
document with form in it.

To test if reference is correct , try placing a simple HTML Button in the
popup and call this self.opener.window.document.forms(0).submit() onclick of
it.


Mardy said:
I saw another source with similar advice but am having trouble with it
I have the following code in a sub in the codebehind of my pop up window.

Dim strUpdate As String = "<script language='Javascript'>Update
=self.opener.window.document.forms(0).submit();</script>"
Page.RegisterClientScriptBlock("Update", strUpdate)

I don't get any errors but the original page doesn't update either

Sreejith Ram said:
You will need to get the handle of the Parent Window and call
Forms[0].Submit(); from the popup.

I think the syntax is
self.opener.window.document.forms[0].submit();



:

Hello

I'm trying to use a pop-up to capture some information and then return the
user to a datagrid containing the changes made in the pop-up.

I have the database update working and the pop-up opens and closes correctly
but I need to find a way to cause the datagrid to refresh once the pop up
closes. How can I force a postback once the pop-up closes?

Thank you
 

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top