473,402 Members | 2,055 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,402 software developers and data experts.

Return values from modal form to main page

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
6 8122
"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
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
"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
> 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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RubiconXing | last post by:
Hi All Beginner question - please be patient with me :-) I am new to c#. If one creates a child modal (and also non-modal) form what is the best way of returning the collected data back to the...
2
by: Matt | last post by:
I want to know how to submit the form data to a modal dialog window? The following is page1.asp, and when the user clicks submit button, it will post the form data to page2.asp by opening a new...
1
by: stellabein | last post by:
Hi friends, I am very very new to programing. i have a one main window from that window i am opening one modal window using showmodaldialog(m.jp...). in that modal window i have a form. when i...
5
by: ChrisR | last post by:
Hi all Ive have a Main Form with Command Buttons down the Left hand side, that open various forms. Clicking on a button opens a Sub Form which is moved to take up 3/4s of the right of the main...
5
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
11
by: joey.powell | last post by:
Hello, I have a windows forms application (VS2005) where I need to do the following... 1. Startup with a main form. 2. Have the user to select a file and then bring up a second form modally...
23
by: Chukkalove | last post by:
Im sorry, I dont know the correct description for a hierarchy of parent and child forms. I have a main form that opens a child form modally. This child form in turn opens it's own child form...
2
by: Mike | last post by:
Hi, I'm having a problem with modal forms on windows. I've written a very short test program, with a main window and a form called from the main window. The form is set to modal with...
1
by: Mohit | last post by:
Hi all, I am working on a windows based client server application with multiple forms. All forms are having custom title bars with no default bars. There is one main form. Some forms are opened up...
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...
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
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
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,...
0
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...
0
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,...

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.