Accessing SQLDataSource SELECTCommand from Iframe

Are there any ways to access parent page's Select command for SQLdatasource from iframe?
The iframe contains listboxes and it creates SQL select statement based on the selections.
I would like to pass it to parent page and show new results.

Is it possible?

Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

That is not possible in .Net

The two pages are independent of one another and have no relation when the page request is being made.

However, if you absolutely wanted to do it, you could simply call the parent page via a HTTP WebRequest and have the page return you just the SQL by using a param you decide on.
jtuttle99Author Commented:
Could you provide me sample code using HTTP WebRequest ? Is it not recommended method??? Do you think Viewstate works?

Thank you
Two different pages do not share viewstate so it wont work
HTTP Web Request is not recommemded but that should solve your problem.

You can use the code below to make a request, make sure you change the URL to your page's URL

Also on the main page you might want to add a parameterized condition that would return the SQL


If IsPageLoad Then
 If request.querystring("RETURNSQL") <> "" Then
  Response.Write("Select 1")
 End If
End If
HttpWebRequest Req = (HttpWebRequest) WebRequest.Create("");
			Req.CookieContainer = CC; 

			WebResponse webResponse = Req.GetResponse();
			string sTxt = new System.IO.StreamReader(webResponse.GetResponseStream(),

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can probably use the QueryStringParameters
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.