?
Solved

Passing back values to main webform from popout form

Posted on 2006-06-06
7
Medium Priority
?
396 Views
Last Modified: 2012-05-05
Hi, i have a main webform that has a button on it...when the user clicks on a button, a new page will pop out and the user can make his selection on the page. After he has made his choice, he clicked on an "OK" button and the form will close and pass back to the main form and display his selection onto a textbox or label.

Anyone who knows the ways to do it or has links to snippet codes. Please post them here :) thanks.

Once again thanks for the time.

0
Comment
Question by:jaxrpc
7 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16849092
take a look here for the documented code
http://www.eggheadcafe.com/articles/20060117.asp

Good luck
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 1800 total points
ID: 16849121
Hi,
Add 2 web forms.

For web form1 add this script
<body MS_POSITIONING="GridLayout">
            <script language="javascript">
                  function display()
                  {
                        retvalue=window.showModalDialog("WebForm3.aspx",'', 'dialogHeight:485px;dialogWidth:500px;center:yes;scroll:no;status:no;help:no');
                        document.Form1.txtVal.value=retvalue;
                                          
                      }
            </script>
            <form id="Form1" method="post" runat="server">
                  <INPUT style="Z-INDEX: 103; LEFT: 328px; POSITION: absolute; TOP: 304px" type="button"
                        value="New Form" name="New Form" id="New Form" onclick="display();"><INPUT id="txtVal" style="Z-INDEX: 104; LEFT: 288px; POSITION: absolute; TOP: 256px" type="text"
                        name="txtVal">
            </form>
      </body>


For web form2, add this script,
----------------------------------------
<HEAD>
            <title>WebForm3</title>
            <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
            <base target="_self">
      </HEAD>
      <body MS_POSITIONING="GridLayout">
            <script language="javascript">
                  function return_Value()
                  {
                         window.returnValue=document.Form1.txtVal.value;
                     window.close();      
                                    
                      }
            </script>
            <form id="Form1" method="post" runat="server">
                  <INPUT id="ok" style="Z-INDEX: 101; LEFT: 248px; WIDTH: 88px; POSITION: absolute; TOP: 176px; HEIGHT: 24px"
                        type="button" value="ok" name="ok" onclick="return_Value();"> <INPUT id="txtVal" style="Z-INDEX: 102; LEFT: 232px; POSITION: absolute; TOP: 128px" type="text"
                        name="txtVal">
            </form>
      </body>


don't forget this line.<base target="_self">

Regards
R. Pradeep sudharsan
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 200 total points
ID: 16849156
is showing the form modally an option? If yes then the above solution would work. else u have to define a function in the main form which accepts parameters that u want to pass on from the child form .. and when the user closes the main form u can call this function and pass all the required values using
window.opener.functionName(parameter1, parmaeter2 ...) .. the function could then store them in local variables and can be used later ....

Rejo
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16849169
modal windows work with IE only.
0
 
LVL 3

Expert Comment

by:EtherZa
ID: 16849873
If you are considering using a modal window, rather have a look at subModal (http://www.subimage.com/sublog/subModal).

It's a javascript solution to create an inline iframe and hide the page through a transparent shadow/mask. A value can be returned by assigning it to "window.returnVal" in the modal before calling "window.top.hidePopWin(true)". It will then be available as the first parameter of the "returnFunc".

Example: http://www.subimage.com/dhtml/subModal/
0
 
LVL 3

Expert Comment

by:EtherZa
ID: 16849877
sorry! forgot to mention that subModal is cross-browser too :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question