Passing HTML from silverlight to an HTMLPage

6 posts, 0 answers
  1. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 02 Sep 2011 Link to this post

    This is with reference to the following url :

    http://www.telerik.com/support/kb/silverlight/htmlplaceholder/htmlplaceholder-javascript.aspx

    Here normal text is being passed to the HTML page.

    In the same function I tried passing the following string  :

    string abcde = "<html xmlns:v='urn:schemas-microsoft-com:vml'><body>this is first</body></html>";
    string code = "document.getElementById('myIFrame').contentDocument.body.innerHTML = '" + abcde + "'";
    HtmlPage.Window.Eval(code);

    which is throwing the exception "Eval FAiled"
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 02 Sep 2011 Link to this post

    Hello Mirang,

    If appears that ContentDocument is null. You can check that with the following code:

    string code = "alert(document.getElementById('myIFrame').contentDocument != null)";

    Greetings,
    Kiril Stanoev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 02 Sep 2011 Link to this post

    The same code works for a different string
    string abcde = "<html><body>this is first</body></html>";
    string code = "document.getElementById('myIFrame').contentDocument.body.innerHTML = '" + abcde + "'";
    HtmlPage.Window.Eval(code);

    the only string missing is in the above string is :
    xmlns:v='urn:schemas-microsoft-com:vml'
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 06 Sep 2011 Link to this post

    Hello Mirang,

    I am still getting the same error. Please take a look at the attached project for further reference and let me know if I am missing anything. I am testing against Internet Explorer 9 (9.0.8112.16421).

    Kind regards,
    Kiril Stanoev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 07 Sep 2011 Link to this post

    The attached project runs on my end, i am also using the same internet explorer version 9 (9.0.8112.16421).
  7. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 08 Sep 2011 Link to this post

    Hi Mirang,

    Since the example works at your end, you can remove the xmlns:v='urn:schemas-microsoft-com:vml', since this namespace is really not necessary for  VML in order to work properly with IE.

    http://groups.google.com/group/google-maps-api/browse_thread/thread/2f3b8c2ff261873a?pli=1

    Kind regards,
    Kiril Stanoev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top
DevCraft banner