Solved

iframe request parent page querystring

Posted on 2011-03-10
7
1,708 Views
Last Modified: 2012-06-27
Parent.Page.Request.QueryString("In")

Hello, I tried the above to retrieve the parent page querystring but I get an error.
 System.NullReferenceException: Object reference not set to an instance of an object.

in vb how can I retrieve the querystring value to pass to my parameter?

0
Comment
Question by:sevensnake77
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:Huseyin KAHRAMAN
ID: 35097709
just use

Request.QueryString("In")

or simply:

Request("In")


0
 
LVL 9

Author Comment

by:sevensnake77
ID: 35097728
You did not read the entire question i suppose,
The page is in a iframe but I need the query string from the parent page the iframe lives.
0
 
LVL 51

Expert Comment

by:Huseyin KAHRAMAN
ID: 35097801
do you mean this?

page.aspx has an iframe inside, say name=myFrame, src=frame.aspx

you call page.aspx?in=HK and somehow you post the myFrame and in the code frame.aspx.vb you want to get the in parameter of page.aspx?

if this is the case, you should create a hidden variable in frame.aspx and set it to "in" param before submitting it on client side, either with js or when you construct the src attribute of frame

like

<iframe src='frame.aspx?in=<%=request("in") %>' ...>
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 51

Expert Comment

by:Huseyin KAHRAMAN
ID: 35097809
or use session...

on page.aspx.vb page_load event

session("in")=request("in")

then use session("in") in frame.aspx.vb
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 35097819
I tried a session but i thought there was another way on the server side.
0
 
LVL 51

Accepted Solution

by:
Huseyin KAHRAMAN earned 500 total points
ID: 35098095
on the server you cannot get the parent page of browser :)

somehow you should pass that parameter to the server when iframe src is requested (either adding id to url or setting a cookie or setting a hidden variable and post it) or use session...

in your case simplest way is set a session whenever you have that param and use it later when you need...
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 35098427
ts
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video teaches viewers how to process images for a time-lapse video. Programs required: Adobe Lightroom, Adobe After Effects, Video Editing Program. In Adobe Lightroom: Import sequence image files into Adobe Lightroom: Develop settings of an I…
Viewers will learn the basics of making and using Impulse Kits in Ableton Live. Load new Impulse into an empty MIDI track: Fill the 8 empty sample slots with drum samples: Adjust parameters to tailor each sound as desired: Proceed to create be…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question