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

This might help. Not entirely sure if it'll do what you need it to but it seems like it might.

Hope this helps :) Please mark solved if it resolves your issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.