Question

I have a asp.net page (redaktionsplan.aspx), which contains a iframe, which also represent a asp.net-page:

<iframe src='test.aspx' height="1000px" width="700px" frameborder="0">

test.aspx contains a control (label1). Now, I want in the OnLoad-Event of the label1 (which is on test.aspx) (in CodeBehind of the label1) access a control which is on redaktionsplan.aspx.

How is this possible?

Was it helpful?

Solution

You cannot access controls of another page on the server.

The two pages are requested by the browser with two separate HTTP GET requests: the first one for redaktionsplan.aspx, then when that page is rendered in the browser, another request is made for test.aspx.

So the code-behind on these two pages runs sequentially (not at the same time) and in the context of two different requests.

If you need to exchange data between two pages, then you can for example:

  • let the first page store the data in the session, so that during the second request you can access it
  • implement the functionality on the client side, using javascript
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top