This is a migrated thread and some comments may be shown as answers.
setting "src" of an IFrame dynamicly cause error
2 Answers 45 Views
This is a migrated thread and some comments may be shown as answers.
Hoang
Top achievements
Rank 1
Hoang asked on 17 Jun 2009, 07:39 PM
Hi,

I have a page with 3 tabs, in one of the tab, I have the following code:

 

 

 

 

<telerik:RadPageView ID="HomePage" runat="server">  
        <iframe id="HomeIframe" width="100%" height="100%" runat="server" frameborder="0" /> 
</telerik:RadPageView> 

 

 


In the pageload event, if I set the src attribute of the iframe to :

 

 

HomeIframe.Attributes["src"] = "www.google.com"; 

 

 

Then it would append the solution name to the url as: mysolution/www.google.com and display a 404 error on the page.

But if i set it to : 
HomeIframe.Attributes["src"] = "http://www.google.com"; 

Then I get these errors:

"htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus"
and
"htmlfile: Access is denied."

Does anyone know what could be causing the error?

2 Answers, 1 is accepted

Sort by
0
Alex Lawson
Top achievements
Rank 1
answered on 18 Jun 2009, 09:21 AM
No idea why that bug occurs, I normally create the iframe within a DIV from client side if that helps?

document.getElementById('divDisplay').innerHTML = "<iframe src='" + strURL + "' width='100%' height='800px'></iframe>";


0
Hoang
Top achievements
Rank 1
answered on 18 Jun 2009, 06:45 PM
Thanks, I endup register the URL as clientsidescript in the pageload event, and set the "src" through javascript and it seem to work.  No clue why doing it through javascript work, but not through the code-behind.
Asked by
Hoang
Top achievements
Rank 1
Answers by
Alex Lawson
Top achievements
Rank 1
Hoang
Top achievements
Rank 1
Share this question
or