Connecting Tech Pros Worldwide Forums | Help | Site Map

Close pop-up and postback

Mardy
Guest
 
Posts: n/a
#1: Nov 19 '05
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
Sreejith Ram
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Close pop-up and postback


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" wrote:
[color=blue]
> 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[/color]
Mardy
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Close pop-up and postback


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" wrote:
[color=blue]
> 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" wrote:
>[color=green]
> > 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[/color][/color]
Sreejith Ram
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Close pop-up and postback


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" wrote:
[color=blue]
> 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" wrote:
>[color=green]
> > 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" wrote:
> >[color=darkred]
> > > 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[/color][/color][/color]
Mardy
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Close pop-up and postback




"Sreejith Ram" wrote:
[color=blue]
> 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" wrote:
>[color=green]
> > 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" wrote:
> >[color=darkred]
> > > 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" wrote:
> > >
> > > > 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[/color][/color][/color]
Mardy
Guest
 
Posts: n/a
#6: Nov 19 '05

re: Close pop-up and postback


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" wrote:
[color=blue]
> 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" wrote:
>[color=green]
> > 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" wrote:
> >[color=darkred]
> > > 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" wrote:
> > >
> > > > 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[/color][/color][/color]
Closed Thread


Similar ASP.NET bytes