473,897 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

returning a value back to parent page from a popup page

Hi all,

Which is the best way to return a value back to the web page from a pop
up page?
I have a asp.net web application which opens a popup page on a link
button click. The Link button is contained in a datagrid column. When i
submit the popup page I want a value from the page to be returned to
the parent page and is to be updated in a dataset, thereby updating the
datagrid. I want the parent page to be refreshed on submitting the pop
up page. i have used Javascript window.open method to open the popup
page.

Aug 27 '06 #1
5 4407
The standard way of opening a popup is a showModalDialog call. Then you can
set window.returnVa lue property in the popup page and the calling page will
get it as a return value from the showModalDialog call.

After the call you can submit the form calling myForm.submit() method. This
will fire a postback to the server for the calling page.

window.open starts another browser window, it is not the same as a modal
dialog.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"knowdotnet " <ra******@gmail .comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Hi all,

Which is the best way to return a value back to the web page from a pop
up page?
I have a asp.net web application which opens a popup page on a link
button click. The Link button is contained in a datagrid column. When i
submit the popup page I want a value from the page to be returned to
the parent page and is to be updated in a dataset, thereby updating the
datagrid. I want the parent page to be refreshed on submitting the pop
up page. i have used Javascript window.open method to open the popup
page.

Aug 27 '06 #2
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:et******** ******@TK2MSFTN GP02.phx.gbl...
The standard way of opening a popup is a showModalDialog call.
So long as you're not interested about cross-browser compatibility.. .
Aug 27 '06 #3
Hi,

Eliyahu Goldin wrote:
The standard way of opening a popup is a showModalDialog call. Then you can
set window.returnVa lue property in the popup page and the calling page will
get it as a return value from the showModalDialog call.
Very non-standard. Works only in IE. You should really mention that when
you give this kind of advice...

After the call you can submit the form calling myForm.submit() method. This
will fire a postback to the server for the calling page.

window.open starts another browser window, it is not the same as a modal
dialog.
Actually, it's very possible to open a modal window using window.open
and the modal, dependent or dialog features (or a combination of these).
Works in the Mozilla-family only.
http://developer.mozilla.org/en/docs...hrome_features

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 27 '06 #4

Thanks for the showModalDialog suggesion, I tried using the same, it
worked fine.

I am using the following code to open and return with the popup page.
But one problem is only when the link button(a bound template column in
the datagrid) is clicked twice the popup page opens, this happens only
on the first time, othertimes the popup page opens on the first click
itself.

please give me more information on myForm.submit()
=============== =============== =============
' code to open a popup
' this is the code behind in the parent page
=============== =============== =============
Private Sub dgConfig_ItemCo mmand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgConfig.ItemCo mmand
Select Case e.Item.ItemType
Case ListItemType.It em, ListItemType.Al ternatingItem,
ListItemType.Ed itItem
CType(e.Item.Fi ndControl("Link Button2"),
LinkButton).Att ributes.Add("on click", "var strReturn;
strReturn=windo w.showModalDial og('childwin.as px',null,'statu s:no;dialogWidt h:370px;dialogH eight:220px;dia logHide:true;he lp:no;scroll:ye s');if
(strReturn != null)
document.getEle mentById('txtVa lue').value=str Return;")

End Select

End Sub
=============== =============== =============== ====

Aug 28 '06 #5
can any one help me in this regard,
thanks in advance
knowdotnet wrote:
Thanks for the showModalDialog suggesion, I tried using the same, it
worked fine.

I am using the following code to open and return with the popup page.
But one problem is only when the link button(a bound template column in
the datagrid) is clicked twice the popup page opens, this happens only
on the first time, othertimes the popup page opens on the first click
itself.

please give me more information on myForm.submit()
=============== =============== =============
' code to open a popup
' this is the code behind in the parent page
=============== =============== =============
Private Sub dgConfig_ItemCo mmand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgConfig.ItemCo mmand
Select Case e.Item.ItemType
Case ListItemType.It em, ListItemType.Al ternatingItem,
ListItemType.Ed itItem
CType(e.Item.Fi ndControl("Link Button2"),
LinkButton).Att ributes.Add("on click", "var strReturn;
strReturn=windo w.showModalDial og('childwin.as px',null,'statu s:no;dialogWidt h:370px;dialogH eight:220px;dia logHide:true;he lp:no;scroll:ye s');if
(strReturn != null)
document.getEle mentById('txtVa lue').value=str Return;")

End Select

End Sub
=============== =============== =============== ====
Sep 6 '06 #6

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

Similar topics

6
2040
by: Logger | last post by:
Help, Want someone's option. I'm calling a popup screen, say form B, to add/edit a record. In, say form A, I call form B using javascript window.open in server side code. I need to know when I come back to form A so I can refresh the screen from the database if a record was added or the data changed that I'm displaying. My question is: What is the best way to figure out when form b finishes and return to form A so that I can run this...
2
1865
by: Bill S. | last post by:
Hey, I am trying to figure this out. The hyperlinks on my page open up a small popup window. I have no reason to refresh the parent page or what have you. I was living in a very happy world, with no problems or disturbances. However, a problem has since arisen: The search engines have indexed these popup pages. So, you load them, but there are no links on them, and there is no parent page. Many people would not check out the url and...
4
22227
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a description and a class_id (stored in the value attribute of each option). The user will then select a class from the drop-down list. What I want to do is have a control in the parent browser window which can store the class_id and the...
4
29931
by: PH | last post by:
Does anyone know how to have the pop-up javascript alert, Response.Write("<script language=javascript>alert('HEY!');</script>); , pop-up after the page has been posted back? I am pressing a button, validating data and then wanting to simply pop-up an alert if say the login is empty. When I click the button though the page is blank but the pop-up is there.
5
4623
by: Peter | last post by:
1) I have a C# web application and what I am trying to do is create a popup window from a link on the parent window 2) the popup window will have a button and when a user clicks on the button the program should update a database, close the window and refresh the parent window. My question is does anyone have a example of popup window wich will close it's self and refresh the parent window when a user clicks on a button? I know there are...
2
2968
by: Flinky Wisty Pomm | last post by:
Okay, I'm pretty baffled by this one. I've got a page in a popup which takes a postcode; looks up a list of addresses for that postcode; then uses a callback to get the details for a specific address, build a JS object and pass it back to the window.opener. This used to work, but without any obvious cause it has started throwing an error. The error text comprises the XML returned from the server AND (mysteriously) the viewstate....
2
9934
by: Bruno | last post by:
Hi ... I have a webpage popup (lets call it POPUP) which refreshes the opener window (this one we call PARENT) when we close it, saying we want to save data. For this, we use top.oWndOpener.refresh();
6
1439
by: Ralf | last post by:
I have a window where I am adding rows to a table. One of the features is to change a group name for given rows. They want another window to open up to create new groups, edit them, etc. I have done this, but when they close the window they want the value they changed to show up in the row. There is only one row for it to go in, but I don't know how to transfer back to the window and have the value in place to add to the row. I am...
0
11250
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10850
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10941
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9656
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5873
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4698
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4293
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3300
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.