PDA

View Full Version : ASP: calling querystring value in iframe


cancer10
08-27-2008, 01:47 PM
Hey,

Urgent help needed.


I have an .asp page (index.asp) and I have an <iframe src="myframe.asp"> in that .asp page.

Is there any way I can fetch the value that is being passed in the index.asp querystring in myframe.asp page?


so, suppose the link: http://mydomain.com/index.asp?id=5

can I fetch that value of id in the myframe.asp page (which is the iframe page)? If yes, How?




Thanx

SSJ
08-27-2008, 01:57 PM
to access the parent query string from inside the iframe page you use this javascript code.

var parentUrl = parent.location.href; this will return the parent window query string and save it into a variable.

now you can split the variable and take the data u want and save it in a hidden asp:textBox control which you can use its value from the code behind page and process your work.

hope the above information was helpful.

cancer10
08-27-2008, 01:58 PM
Hey


Found the solution:

I could pass the parameter when calling the page in the source of the iframe...

<iframe src="myframe.asp?id=<% =request.Querystring("id")%>">


Thnx