.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Read a value in a parent and grand parent window and grand parent window using javascript

Posted By:Deco       Posted Date: September 23, 2010    Points: 5    Category: Javascript    URL: http://www.dotnetspark.com  

helps to get the parent window textbox value

The following code sample will help you to read data from the parent page from the child page.

Assume that you are having two pages in your sample application

let say the first page is "WebForm1.aspx" and the second page is "WebForm2.aspx"

Now in your application you have opened the Second page from the first page using window.open()

and in the situation, you need to access the TextBox value of WebForm1 from Webform2

you can use the below code.

Var FirstPageValue = window.parent.document.getElementById("TextBox1").value;
To read a value from a GrandParent window, you can use;

Var FirstPageValue = window.parent.parent.document.getElementById("TextBox1").value;


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend