By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

returning a value back to parent page from a popup page

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.