Friday, January 25, 2008

Inserting Values in Parent Page from a Pop-Up Wndow

function parent_location()

{

var firstname ,lastname ;

//store value in variables using getelementbyid

firstname = document.getElementById("txtFname").value;

lastname = document.getElementById("txtLname").value;

//value send in parent form

window.opener.document.getElementById( "ctl00_ContentPlaceHolder1_TextBox_FName").value = firstname;

window.opener.document.getElementById( "ctl00_ContentPlaceHolder1_TextBox_LName").value = lastname;

//closing the PopUp window

window.close();

}


=================================================

Add this Code on Page_Load ...

Button2.Attributes.Add("onclick", "javascript:return parent_location()");


-
ShriKrishna Bhardwaj , With ASP.Net, SQL Server, Javascript

No comments: