0

hi.,

there is a parent page and child page . when i click parent page button it should go to child page and take values from there and return to preivous page its not working :(

parent page:

public class Default : Page
    {
        protected TextBox txtFirstName;
        protected TextBox txtLastName;
        protected Label Label1;
        protected Label Label2;
        protected HyperLink HyperLink1;

        private void Page_Load(object sender, EventArgs e)
        {
            //create our update function
            string scr = @"<script>
                    function update(elemValue)
                  {
                    document.getElementById('txtFirstName').innerText=elemValue[0];
                    document.getElementById('txtLastName').innerText=elemValue[1];
                  }
                  </script>";
            // register the javascript into the Page
            Page.RegisterClientScriptBlock("update", scr);
            //add our popup onclick attribute to the desired element on the page (Here, Hyperlink1)
            HyperLink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'left=400, top=100, height=250, width= 250, status=n o, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');");


        }

child page

public class popup : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.TextBox TextBox1;
        protected System.Web.UI.WebControls.Label Label2;
        protected System.Web.UI.WebControls.TextBox txtLastName;
        protected System.Web.UI.WebControls.TextBox txtFirstName;
        protected System.Web.UI.WebControls.Label Label1;

        private void Page_Load(object sender, System.EventArgs e)
        { 
            string scr= @"<script>
        function Done()
            {                                                                               
            var fName=document.getElementById('txtFirstName').value;     
var lName=document.getElementById('txtLastName').value;   
var ret= new Array(fName,lName);
window.opener.update(ret);       
            window.close(); 
            } 
           </script>;";
            Page.RegisterClientScriptBlock("done", scr);
        }

and this code taken from article in eggheads.com and link is

http://www.eggheadcafe.com/articles/20060117.asp. and even there is a project file but its not working

a

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by Lusiphur
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.