473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

javascript in popup calling some function in main web form

I've got an add form with a link that opens a pop up window. The main
add form has a drop down menu with items populated from a db. In the
popup window, you can add additional items to the db, so when you do,
what I'd like to do is somehow refresh the main screen to show the
updates, but at the same time, keeping any data in the page that the
user has already entered. Has anyone found a solution for these types
of situations? Thanks.
Nov 18 '05 #1
10 2075
Hi,

if the main page has JavaScript method "methodname" declared, you can always
call it from the popup by using:

window.opener.methodname(<possible arguments>);

This method could cause a postback or reload or whatever at the main page.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"geoff" <ca********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
I've got an add form with a link that opens a pop up window. The main
add form has a drop down menu with items populated from a db. In the
popup window, you can add additional items to the db, so when you do,
what I'd like to do is somehow refresh the main screen to show the
updates, but at the same time, keeping any data in the page that the
user has already entered. Has anyone found a solution for these types
of situations? Thanks.
Nov 18 '05 #2
Hi,

if the main page has JavaScript method "methodname" declared, you can always
call it from the popup by using:

window.opener.methodname(<possible arguments>);

This method could cause a postback or reload or whatever at the main page.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"geoff" <ca********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
I've got an add form with a link that opens a pop up window. The main
add form has a drop down menu with items populated from a db. In the
popup window, you can add additional items to the db, so when you do,
what I'd like to do is somehow refresh the main screen to show the
updates, but at the same time, keeping any data in the page that the
user has already entered. Has anyone found a solution for these types
of situations? Thanks.
Nov 18 '05 #3
Sorry, guess I should have clarified. I realize that I can call a
javascript function that way in the main page... my biggest hurdle is
how can I get javascript to do a postback?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Sorry, guess I should have clarified. I realize that I can call a
javascript function that way in the main page... my biggest hurdle is
how can I get javascript to do a postback?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
Try add the code like following in the function in the main page

window.form1.submit()

Bin Song, MC

----- geoff tyler wrote: ----

Sorry, guess I should have clarified. I realize that I can call
javascript function that way in the main page... my biggest hurdle i
how can I get javascript to do a postback

*** Sent via Developersdex http://www.developersdex.com **
Don't just participate in USENET...get rewarded for it

Nov 18 '05 #6
Try add the code like following in the function in the main page

window.form1.submit()

Bin Song, MC

----- geoff tyler wrote: ----

Sorry, guess I should have clarified. I realize that I can call
javascript function that way in the main page... my biggest hurdle i
how can I get javascript to do a postback

*** Sent via Developersdex http://www.developersdex.com **
Don't just participate in USENET...get rewarded for it

Nov 18 '05 #7
You can try calling submit() for the form, but you could also try to post in
behalf of another control say a button on form, if taht's suitable. You can
generate the script for this by using Page.GetPostBackEventReference, and
this returned js snippet you place inside the function which you call from
popup window.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"geoff tyler" <ca********@hotmail.com> wrote in message
news:em*************@tk2msftngp13.phx.gbl...
Sorry, guess I should have clarified. I realize that I can call a
javascript function that way in the main page... my biggest hurdle is
how can I get javascript to do a postback?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #8
You can try calling submit() for the form, but you could also try to post in
behalf of another control say a button on form, if taht's suitable. You can
generate the script for this by using Page.GetPostBackEventReference, and
this returned js snippet you place inside the function which you call from
popup window.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"geoff tyler" <ca********@hotmail.com> wrote in message
news:em*************@tk2msftngp13.phx.gbl...
Sorry, guess I should have clarified. I realize that I can call a
javascript function that way in the main page... my biggest hurdle is
how can I get javascript to do a postback?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #9
Teemu, thanks - that worked perfectly. I already had a refresh link set
up to refresh the source, so I just called the javascript that is called
when you click that link and it worked great. Thanks a lot!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #10
Teemu, thanks - that worked perfectly. I already had a refresh link set
up to refresh the source, so I just called the javascript that is called
when you click that link and it worked great. Thanks a lot!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
3
by: John Bokma | last post by:
I have two windows in a frame. I want to be able that each can open a pop up window and that the handle to that window can be stored somewhere, so that each can talk to the pop up. is it...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
4
by: Colin Graham | last post by:
Hi guys, Just a quickie here that i hope someone can help me with. Basically i want stop the user from closing the popup window using the small x button in the top right hand corner. Im aware...
12
by: Mark Fox | last post by:
Hello, I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some...
5
by: geoff | last post by:
I've got an add form with a link that opens a pop up window. The main add form has a drop down menu with items populated from a db. In the popup window, you can add additional items to the db, so...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
4
by: Charleees | last post by:
GIFS not working properly in JavaScript PopUps Hi all, I have a button and when i click tha button it redirects to another page..... I have also added a java script for the button that...
3
by: Jimmy | last post by:
It is also possible for popup window to call function in main window by using the opener property. Will "opener.someFunctionInMain(param1, param2)" in the popup window work? It's possible for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.