Calling javascript in HTMLPlaceHolder

6 posts, 0 answers
  1. Nguyen Viet Cuong
    Nguyen Viet Cuong avatar
    3 posts
    Member since:
    Nov 2009

    Posted 20 Nov 2009 Link to this post

    Hi Telerik team,

    I have a code to show/hide text in html like this (when user clicks "Some Title" hyperlink a new text will diplay).
    ---------------------
    <html><head><title>Untitled</title>
    <script language="JavaScript">function showAndHide(theId)
    {
     var el = document.getElementById(theId);
     if (el.style.display=="none")
     {
      el.style.display="block";
     }
     else
     {
      el.style.display="none";
     }
    }
    </script>
    </head>
    <body><p><a href="#" onClick = showAndHide('Title')>Some Title</a></p>
    <div id='Title' style="display:none">
    <a href="http://www.blah.com/">01-Intro</a></div> </body></html>
    ---------------------
    Now, I have to display this text in HTMLPlaceHolder. To do this, I have call a javascript function like "showAndHide" in HTMLPlaceHolder. How can I do it in HTMLPlaceHolder?

    Thanks!

  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 25 Nov 2009 Link to this post

    Hello Nguyen,

    Please read the following KB article and let me know if you need further assisstance:
    http://www.telerik.com/support/kb/silverlight/htmlplaceholder/htmlplaceholder-javascript.aspx

    Best wishes,
    Tihomir Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Nguyen Viet Cuong
    Nguyen Viet Cuong avatar
    3 posts
    Member since:
    Nov 2009

    Posted 25 Nov 2009 Link to this post

    Thank Petkov for your reply!

    I read KB article and it seems is not what I expected. I will describle my problem more detail:
    I have an article display in HTMLPlaceHolder, it contains some "glossaries". When user clicks on a glossary, the HTMLPlaceHolder  will be expanded to show the Glossary description. Example:

    Windows 7 improves how you view and connect to all of your networks, making the process simple and consistent. always have one-click access to available networks, regardless of whether those networks are based on Wi-Fi, mobile broadband, dial-up, or your corporate VPN.

     

    In that article: Windows 7, Wi-Fi are glossaries. If user clicks on "Windows 7" a  text will be appened like this:
    Windows 7 { Windows 7 is a new operation system} improves how you view and connect....

    In HTML, I can do this very simple by using "ShowAndHide" function. And my question is how can I create a function like "ShowAndHide" in HTMLPlaceHolder?

    Thanks in advance!

  5. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 30 Nov 2009 Link to this post

    Hi Nguyen,

    All you need to do is put the JavaScript function in the document you want to display in the HtmlPlaceholder control. I prepared a sample project which you can take a look at and let me know if it helps.

    Greetings,
    Tihomir Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Nguyen Viet Cuong
    Nguyen Viet Cuong avatar
    3 posts
    Member since:
    Nov 2009

    Posted 04 Dec 2009 Link to this post

    Thank Petkov, it runs fine. There is a small problem: As I add HTMLPlaceHolder to Child Window of Silverlight 3, it seems not work.
  7. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 04 Dec 2009 Link to this post

    Hi Nguyen Viet Cuong,

    This is a know issue with the Q3 release. You can download the latest internal build or wait for the SP1 that is next week, which fixes the issue.

    Best wishes,
    Valentin.Stoychev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
DevCraft banner