469,953 Members | 2,256 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,953 developers. It's quick & easy.

DoPostBack from Popup (Child) Window

Hello,

I have a custom control that is used to select a location from a list
of locations. When put on the page it creates an asp:textbox (used to
display the name of the location), a hidden field (which stores the
primary key of the location from the DB) and an image button. When you
click the image button a popup is created that allows you to select an
item from a complex screen (tabbed interface, etc).

The important thing is that when you have selected the location you
wish and click on the "Select" button in the popup it tries to call
_doPostBack on the Parent Window and then close itself. This works
fine as long as you have some form elements on the page the "force"
asp.net to put the __doPostBack function on the page. But, if you
don't have these items then __doPostBack is not created on the page,
and the child window fails by trying to call a parent method that
doesn't exist.

I need a way to force the "parent" page to create the __doPostBack
method whether it thinks it needs it or not.

I looked into GetPostBackClientEvent, but I don't think I can use it
since I am in a child window.

Any suggestions?

Thanks.
--Nathan
Nov 18 '05 #1
3 7271
I am using RegisterClientScriptBlock
and in it I use window.opener.document.forms[0].submit();
this will allow the parent window to post back.
"Nathan Burleson" <na*************@yahoo.com> wrote in message
news:fc**************************@posting.google.c om...
Hello,

I have a custom control that is used to select a location from a list
of locations. When put on the page it creates an asp:textbox (used to
display the name of the location), a hidden field (which stores the
primary key of the location from the DB) and an image button. When you
click the image button a popup is created that allows you to select an
item from a complex screen (tabbed interface, etc).

The important thing is that when you have selected the location you
wish and click on the "Select" button in the popup it tries to call
_doPostBack on the Parent Window and then close itself. This works
fine as long as you have some form elements on the page the "force"
asp.net to put the __doPostBack function on the page. But, if you
don't have these items then __doPostBack is not created on the page,
and the child window fails by trying to call a parent method that
doesn't exist.

I need a way to force the "parent" page to create the __doPostBack
method whether it thinks it needs it or not.

I looked into GetPostBackClientEvent, but I don't think I can use it
since I am in a child window.

Any suggestions?

Thanks.
--Nathan

Nov 18 '05 #2
I am using RegisterClientScriptBlock
and in it I use window.opener.document.forms[0].submit();
this will allow the parent window to post back.
"Nathan Burleson" <na*************@yahoo.com> wrote in message
news:fc**************************@posting.google.c om...
Hello,

I have a custom control that is used to select a location from a list
of locations. When put on the page it creates an asp:textbox (used to
display the name of the location), a hidden field (which stores the
primary key of the location from the DB) and an image button. When you
click the image button a popup is created that allows you to select an
item from a complex screen (tabbed interface, etc).

The important thing is that when you have selected the location you
wish and click on the "Select" button in the popup it tries to call
_doPostBack on the Parent Window and then close itself. This works
fine as long as you have some form elements on the page the "force"
asp.net to put the __doPostBack function on the page. But, if you
don't have these items then __doPostBack is not created on the page,
and the child window fails by trying to call a parent method that
doesn't exist.

I need a way to force the "parent" page to create the __doPostBack
method whether it thinks it needs it or not.

I looked into GetPostBackClientEvent, but I don't think I can use it
since I am in a child window.

Any suggestions?

Thanks.
--Nathan

Nov 18 '05 #3
Hello Ather,

Thanks for the quick response. However, in my case I can not just
submit the form as there may be Validators on the "parent" page. I did
find a solution for your future reference.

I perform the following call inside the container page which houses
the child control:

Page.GetPostBackClientEvent(LC1, "")

LC1 refers to the child control. This forces asp.net to put the
__doPostBack client javascript onto the page.

Thanks again for your help.
--Nathan

"Ather Ali Shaikh" <at*******@eintelligencesoft.com> wrote in message news:<#m**************@tk2msftngp13.phx.gbl>...
I am using RegisterClientScriptBlock
and in it I use window.opener.document.forms[0].submit();
this will allow the parent window to post back.
"Nathan Burleson" <na*************@yahoo.com> wrote in message
news:fc**************************@posting.google.c om...
Hello,

I have a custom control that is used to select a location from a list
of locations. When put on the page it creates an asp:textbox (used to
display the name of the location), a hidden field (which stores the
primary key of the location from the DB) and an image button. When you
click the image button a popup is created that allows you to select an
item from a complex screen (tabbed interface, etc).

The important thing is that when you have selected the location you
wish and click on the "Select" button in the popup it tries to call
_doPostBack on the Parent Window and then close itself. This works
fine as long as you have some form elements on the page the "force"
asp.net to put the __doPostBack function on the page. But, if you
don't have these items then __doPostBack is not created on the page,
and the child window fails by trying to call a parent method that
doesn't exist.

I need a way to force the "parent" page to create the __doPostBack
method whether it thinks it needs it or not.

I looked into GetPostBackClientEvent, but I don't think I can use it
since I am in a child window.

Any suggestions?

Thanks.
--Nathan

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by HarveyB | last post: by
4 posts views Thread by Colin Graham | last post: by
reply views Thread by Nathan Burleson | last post: by
5 posts views Thread by midnight_use_only | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.