473,385 Members | 1,769 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,385 software developers and data experts.

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 4373
The standard way of opening a popup is a showModalDialog call. Then you can
set window.returnValue 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.googlegr oups.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.orgwrote in
message news:et**************@TK2MSFTNGP02.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.returnValue 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_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgConfig.ItemCommand
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem,
ListItemType.EditItem
CType(e.Item.FindControl("LinkButton2"),
LinkButton).Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('childwin.aspx',n ull,'status:no;dialogWidth:370px;dialogHeight:220p x;dialogHide:true;help:no;scroll:yes');if
(strReturn != null)
document.getElementById('txtValue').value=strRetur n;")

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_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgConfig.ItemCommand
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem,
ListItemType.EditItem
CType(e.Item.FindControl("LinkButton2"),
LinkButton).Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('childwin.aspx',n ull,'status:no;dialogWidth:370px;dialogHeight:220p x;dialogHide:true;help:no;scroll:yes');if
(strReturn != null)
document.getElementById('txtValue').value=strRetur n;")

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
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...
2
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,...
4
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...
4
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...
5
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...
2
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...
2
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 ...
6
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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
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,...

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.