473,624 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8140
"Mark Goldin" <ma********@com cast.net> wrote in message
news:OD******** ******@TK2MSFTN GP11.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.showModa lDialog(...) 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.showModa lDialog(...) / window.returnVa lue
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******** ******@tk2msftn gp13.phx.gbl...
"Mark Goldin" <ma********@com cast.net> wrote in message
news:OD******** ******@TK2MSFTN GP11.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.showModa lDialog(...) 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.showModa lDialog(...) / window.returnVa lue
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.c om/weblog/jpalermo> wrote in
message news:eW******** ******@tk2msftn gp13.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.showModa lDialog(...) / window.returnVa lue
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=ne w Object();
outputObject.a= 1;
outputObject.b= 2;
outputObject.c= 3;
window.returnVa lue=outputObjec t;

Eliyahu
Nov 18 '05 #5
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:uW******** *****@TK2MSFTNG P11.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=ne w Object();
outputObject.a= 1;
outputObject.b= 2;
outputObject.c= 3;
window.returnVa lue=outputObjec t;


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******** ******@tk2msftn gp13.phx.gbl...
"Jeffrey Palermo [MCP]" <http://dotnetjunkies.c om/weblog/jpalermo> wrote in message news:eW******** ******@tk2msftn gp13.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
1709
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 calling form? For example, say off of my main form I launch a modal dialog box that gets the username and password what is the best way of passing that data back? The info has to go into an object eventually so I can
2
3867
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 window. But I want modal dialog window, any ideas?? <form action="page2.asp" method="post" target="_blank"> <input type="text" name="username"> <input type="submit" name="submit"> </form>
1
6104
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 click save button in the form, the for has to submit and the modal window has to close. and the parent window have to refresh itself. this is my modal window page.
5
10035
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 form, so they look as one form. 1st Problem: If I set Modal = True in all Forms, and a Sub Form is open, then I cant access the Command Buttons on the Main Form, which are still
5
3310
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 main form is reactivated following opening and closing a modal form. Strangely, this was not a problem until I started using my Access 2000 db in Access 2003 (as an Access 2000 db). Details follow... I have an unbound combo box on my main form...
11
3234
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 (Form1.ShowDialog()) so that the user can make custom selections. 3. I can store the selections from the second form in many different
23
2731
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 modally. I also have a separate thread running that monitors a card reader. If the user removes the card then the thread calls back the main form to tell it that the card was pulled. The main form should then close down any children leaving the main...
2
2640
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 form.setModal(1) before calling form.show(). All works as expected on Linux. The form is modal, not allowing the main window to received the focus. If I call the form from within itself, the topmost form is modal, and not of the previous forms will...
1
3561
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 as modal while others are opened up as modeless on this main form. Whenever some error occurs in client server communication we show it in modal message box. Now I ran into a case: a modal form is opened up on the main form. And some error...
0
8677
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
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
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...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
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
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
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
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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.