How to reflect the record changes from popup window to main window in ASP.net

sridharb

New member
Joined
Feb 15, 2006
Messages
3
Programming Experience
5-10
Hello,

How can i update main windows datagrid as soon as i enter a new record in a popup window.
 
Hi,

Here may be you can use Session Variables to Pass Values between 2 forms
or use Javascript to Pass value from child(pop-up) form to the parent form.
use HtmlHidden Text boxes if you want to store the value and use it in you code.
Please see a rough sample for code.
here h1 and h2 are HtmlHidden controls.
Parent Form
VB.NET:
<script language="javascript">
function LoadPopup()
{
var oWindow = window.open('popup.aspx','width=400,height=400'); 
}
function ReturnValues(v1,v2)
{
var ct = document.getElementById('h1');
ct.value = v1 ;
var ct1 = document.getElementById('h2');
ct1.value = v2;
document.Form1.submit(); 
 
}
</script> 
[code]
 
[B]Popup Form[/B]
[B]here txt1 and txt2 are Input Boxes where user enters the value.use Button to submit the form.[/B]
[code]
        function Add()    
    {       
      var h1 = document.getElementById('txt1');   
      var h2 = document.getElementById('txt2');  
      window.parent.opener.ReturnValues(h1.value,h2.value);
      self.close(); 
     }   
[code]
 
Hope this gives you some idea to proceed.
 
- Jay
 
Back
Top