Can I get a hold of ASP controls in an ASPX page
-
Hi I have en Asp file lcon.asp in my website project, where I use an Iframe. I want to be able to use the iframe in the code behind from another aspx page.
<iframe runat =server id="left" src="ShowGroups.aspx" scrolling="no" frameborder="0" width="100%" height="1000"></iframe>
I would like to do something like this.
protected System.Web.UI.HtmlControls.HtmlGenericControl frame1;
HtmlControl frame1 = (HtmlControl)this.FindControl("left");
frame1.Attributes["src"] = "http://search.msn.com";But if there is another way to refresh the iframe, please tell me. Fia
-
Hi I have en Asp file lcon.asp in my website project, where I use an Iframe. I want to be able to use the iframe in the code behind from another aspx page.
<iframe runat =server id="left" src="ShowGroups.aspx" scrolling="no" frameborder="0" width="100%" height="1000"></iframe>
I would like to do something like this.
protected System.Web.UI.HtmlControls.HtmlGenericControl frame1;
HtmlControl frame1 = (HtmlControl)this.FindControl("left");
frame1.Attributes["src"] = "http://search.msn.com";But if there is another way to refresh the iframe, please tell me. Fia
-
AFAIK ... no wayout other than javascript. At least the page should be posted back to the aspx page to get the iframe. You need to use custom handler to do this as your actual page is asp. Why dont you convert the asp page to aspx then.
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
AFAIK ... no wayout other than javascript. At least the page should be posted back to the aspx page to get the iframe. You need to use custom handler to do this as your actual page is asp. Why dont you convert the asp page to aspx then.
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Thank's for your answer, but I can't convert or not allowed to convert tha asp page to aspx. What do you mean by post back to the aspx page. And what is custom handler. Fia
I mean say you have a page called
submitRequest.aspx
Now from your Asp page use:<form action ="submitRequest.aspx" >
thus when the page is posted back it goes tosubmitRequest.aspx
. You can get each of those form elements using Request object from submitRequest.aspx (even theIFrame
) where page is your custom handler. You can also use a class which inherits fromIHttpHandler
to call its process request. On the other hand, how could you access the iframe from the server side, if your actual parent page is made using asp. You better use javascript to get reference from Iframe if you do require. I hope you got my point. :)Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
I mean say you have a page called
submitRequest.aspx
Now from your Asp page use:<form action ="submitRequest.aspx" >
thus when the page is posted back it goes tosubmitRequest.aspx
. You can get each of those form elements using Request object from submitRequest.aspx (even theIFrame
) where page is your custom handler. You can also use a class which inherits fromIHttpHandler
to call its process request. On the other hand, how could you access the iframe from the server side, if your actual parent page is made using asp. You better use javascript to get reference from Iframe if you do require. I hope you got my point. :)Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptHi again I'm grateful for your answers, but I'm rather new to asp.net. How should I write to get a hold of the iframe. The iframe have id="left" in the asp page. But when I try Request["left"], I get null. And how am I going to change the src of the iframe. Hope you have time to help me more Fia
-
Hi again I'm grateful for your answers, but I'm rather new to asp.net. How should I write to get a hold of the iframe. The iframe have id="left" in the asp page. But when I try Request["left"], I get null. And how am I going to change the src of the iframe. Hope you have time to help me more Fia
I think you need to use Javascript to communicate between the two pages, one the page that is loaded in iFrame and another is what is written in asp. If you can submit the asp page in a handler custom handler and access Request.Params to get the controls. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
I think you need to use Javascript to communicate between the two pages, one the page that is loaded in iFrame and another is what is written in asp. If you can submit the asp page in a handler custom handler and access Request.Params to get the controls. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript