I have an asp.net page with a textbox and a button. on button click, I open a popup and load a page in it using iframe. I want to pass value of textbox as query string to page in iframe. How can I do this?
I tried using server side iframe like this:
<iframe id="popupframe" runat="server" src="~/temp.aspx" width="100%" height="455">
</iframe>
but temp.aspx doesnt load and gives 404. If I use it without server side tag
<iframe id="popupframe" src="../../../../temp.aspx" width="100%" height="455">
</iframe>
Page loads in iframe but I can’t pass valuue of textbox to temp.aspx. Please suggest solution. thanks
Is temp.aspx definitely at the root of your site? A 404 error is normally a pretty clear indication that the thing that you’re looking for isn’t there! And the fact that you’ve got a relative path in the working plain HTML version makes me think there might be an issue with your server-side version’s path.
As an alternative, you could pass a querystring to your popup page and use some javascript on that page to manipulate the src property of the iframe.
e.g. (script on popup page)
You’d want to run that after the page content has loaded. I don’t know if you’re using jQuery or some other framework (or no framework!) so I won’t go into how to do that (but can if you need me to).