473,386 Members | 1,752 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,386 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 2073
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.