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

Return values from modal form to main page

P: n/a
I have main aspx page with a button that will show a modal
dialog in the Browser when a user clicks on the button.
On the modal form the user will do some selections.
The he will submit his selections to the server via a postback.
How can I take these selections to the main page?

Thanks
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Mark Goldin" <ma********@comcast.net> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
I have main aspx page with a button that will show a modal
dialog in the Browser when a user clicks on the button.
On the modal form the user will do some selections.
The he will submit his selections to the server via a postback.
How can I take these selections to the main page?


I have been struggling with the same problem recently and have come to the
conclusion that I need to rethink the whole architecture for the following
reaons:

1) AFAIK, window.showModalDialog(...) will only work for IE so, if you're
writing a public-facing site, you're going to run into severe cross-browser
issues.

2) It is possible to return only one value to the main form using the var
intReturnValue = window.showModalDialog(...) / window.returnValue
functionality so, if you need to return multiple values, pretty much your
only option is to use Session variables.

3) When you submit a modal dialog, it will launch a new browser instance
unless you enclose it in an iframe - again, this may not be supported in
certain browsers.
Nov 18 '05 #2

P: n/a
Mark,
I have overcome this by passing in "window" to the modal dialog. Then,
with this reference, client script can modify anything on the parent. If
you need pass information back to the parent, you could set some hidden form
fields on the parent through the window reference you have, and then post
the parent back to the server.

Best regards,
Jeffrey Palermo

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
"Mark Goldin" <ma********@comcast.net> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
I have main aspx page with a button that will show a modal
dialog in the Browser when a user clicks on the button.
On the modal form the user will do some selections.
The he will submit his selections to the server via a postback.
How can I take these selections to the main page?
I have been struggling with the same problem recently and have come to the
conclusion that I need to rethink the whole architecture for the following
reaons:

1) AFAIK, window.showModalDialog(...) will only work for IE so, if you're
writing a public-facing site, you're going to run into severe

cross-browser issues.

2) It is possible to return only one value to the main form using the var
intReturnValue = window.showModalDialog(...) / window.returnValue
functionality so, if you need to return multiple values, pretty much your
only option is to use Session variables.

3) When you submit a modal dialog, it will launch a new browser instance
unless you enclose it in an iframe - again, this may not be supported in
certain browsers.

Nov 18 '05 #3

P: n/a
"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote in
message news:eW**************@tk2msftngp13.phx.gbl...
I have overcome this by passing in "window" to the modal dialog. Then,
with this reference, client script can modify anything on the parent.


That's interesting - hadn't thought of that. Do you have a solution to the
submission problem too?
Nov 18 '05 #4

P: n/a
> 2) It is possible to return only one value to the main form using the var
intReturnValue = window.showModalDialog(...) / window.returnValue
functionality so, if you need to return multiple values, pretty much your
only option is to use Session variables.


returnValue is a variant. You can return an object with many fields. For
example, if you need to return value a=1, b=2 and c=3, you can make it in
the dialog window in the following way:

var outputObject=new Object();
outputObject.a=1;
outputObject.b=2;
outputObject.c=3;
window.returnValue=outputObject;

Eliyahu
Nov 18 '05 #5

P: n/a
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uW*************@TK2MSFTNGP11.phx.gbl...
returnValue is a variant. You can return an object with many fields. For
example, if you need to return value a=1, b=2 and c=3, you can make it in
the dialog window in the following way:

var outputObject=new Object();
outputObject.a=1;
outputObject.b=2;
outputObject.c=3;
window.returnValue=outputObject;


Excellent! Thanks very much.
Nov 18 '05 #6

P: n/a
Mark,
No, I haven't ever posted back a page from inside a dialog. I always
used javascript to place some values on my parent page (maybe in a hidden
form field), and then I close the dialog. If I have a onchange handler on
my hidden form field that changes, then I could tell the parent to post back
as soon as that value changes.

Best regards,
Jeffrey Palermo

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote in message news:eW**************@tk2msftngp13.phx.gbl...
I have overcome this by passing in "window" to the modal dialog. Then,
with this reference, client script can modify anything on the parent.


That's interesting - hadn't thought of that. Do you have a solution to the
submission problem too?

Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.