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

RadCodeBlock add JS script programatically

3 Answers 282 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christopher Borys
Top achievements
Rank 1
Christopher Borys asked on 21 Apr 2010, 10:29 PM
I have a RadCodeBlock defined on my page with some JS code but I need to add more JS script dynamically/programatically.
Can someone help?

Chris

3 Answers, 1 is accepted

Sort by
0
Libertas Technologies
Top achievements
Rank 1
answered on 23 Apr 2010, 03:59 AM
I was able to accomplish this by adding a new literal control with the contents of the script. For example:

RadScriptBlock1.Controls.Add(New LiteralControl("<script language=""javascript"" type=""text/javascript"">alert(""Hello World"");</script>"))
0
Christopher Borys
Top achievements
Rank 1
answered on 23 Apr 2010, 04:18 PM
I see you are using RadScriptBlock and I has RadCodeBlock.
What is the fundamental different between those two controls?

Chris
0
Libertas Technologies
Top achievements
Rank 1
answered on 23 Apr 2010, 04:34 PM
This article does a pretty good job of explaining the difference between the two.
http://www.telerik.com/help/aspnet-ajax/ajxradscriptblockradcodeblock.html
Tags
General Discussions
Asked by
Christopher Borys
Top achievements
Rank 1
Answers by
Libertas Technologies
Top achievements
Rank 1
Christopher Borys
Top achievements
Rank 1
Share this question
or