This is a migrated thread and some comments may be shown as answers.

Calling javascript in HTMLPlaceHolder

5 Answers 95 Views
HTMLPlaceHolder
This is a migrated thread and some comments may be shown as answers.
Nguyen Viet Cuong
Top achievements
Rank 1
Nguyen Viet Cuong asked on 21 Nov 2009, 04:48 AM
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!

5 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 25 Nov 2009, 05:51 PM
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.
0
Nguyen Viet Cuong
Top achievements
Rank 1
answered on 26 Nov 2009, 04:56 AM
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!

0
Tihomir Petkov
Telerik team
answered on 30 Nov 2009, 03:02 PM
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.
0
Nguyen Viet Cuong
Top achievements
Rank 1
answered on 04 Dec 2009, 01:52 PM
Thank Petkov, it runs fine. There is a small problem: As I add HTMLPlaceHolder to Child Window of Silverlight 3, it seems not work.
0
Valentin.Stoychev
Telerik team
answered on 04 Dec 2009, 01:56 PM
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.
Tags
HTMLPlaceHolder
Asked by
Nguyen Viet Cuong
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Nguyen Viet Cuong
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Share this question
or