setting "src" of an IFrame dynamicly cause error

3 posts, 0 answers
  1. Hoang
    Hoang avatar
    5 posts
    Member since:
    Apr 2009

    Posted 17 Jun 2009 Link to this post

    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. Alex Lawson
    Alex Lawson avatar
    43 posts
    Member since:
    May 2008

    Posted 18 Jun 2009 Link to this post

    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>";


  3. Hoang
    Hoang avatar
    5 posts
    Member since:
    Apr 2009

    Posted 18 Jun 2009 Link to this post

    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.
Back to Top