0

Using Asp.Net 4.

I have a form that includes 4 fields for the customer to enter numeric data into.

Sometimes it's difficult for the customer to do because they may need to add up some more numbers before arriving at the total figure for each input box.

I'm toying with the idea of adding a calculator link. This would open another page where the customer could input all the minor numbers to find the total. However, what I would like to be able for them to press save then transpose the total figures back to the original page.

I'm unsure how this could be acheived - is it Ajax/javascript? Do I need to use session to maintain the figures?

Any help would be appreciated.

dotnetnoob
  • 10,783
  • 20
  • 57
  • 103

1 Answers1

0

How about the following?

  • Save the values to the Session and then when closing the child window (your calculator) refresh the parent window. This is discussed in this question. Using the code from the question:

Open the window:

window.open("foo.html","windowName", "width=200,height=200,scrollbars=no");

Refresh the parent form by having this in the child window:

 <script>
       window.onunload = refreshParent;
       function refreshParent() {
           window.opener.location.reload();
       }
 </script>
  • Alternatively, you don't have to use the Session at all and just set the values from JavaScript. Something along the lines of the following in your child form (again after opening the child window using window.open();

    <script language="javascript">  
        function UpdateParent() 
        { 
            window.opener.document.getElementById('MyControl').value="New Value"; 
        } 
    </script> 
    
Community
  • 1
  • 1
Damon
  • 3,004
  • 7
  • 24
  • 28