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

RadCodeBlock and RadScriptBlock

5 Answers 1721 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 26 Nov 2008, 02:37 PM
Hello,

Just out of curiosity, what are the RadCodeBlock and RadScriptBlock controls used for?  What is their purpose?  What advantages does the RadScriptBlock give you over defining your own <script></script> tags without it?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 26 Nov 2008, 03:10 PM
Hi Brian,

Standard UpdatePanel cannot register any declared <script> blocks. If you wrap your declared JavaScript blocks with RadScriptBlock RadAjaxManager and RadAjaxPanel will register automatically these scripts.

With RadCodeBlock you can wrap parts of the page where you have Code Render Blocks.

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
sglad007
Top achievements
Rank 1
answered on 25 Feb 2014, 03:39 AM
so pretty much if we use RadScript, we are covered for both the cases. So would it safe to say that if had to choose between the two [ScriptBlock vs CodeBlock], ScriptBlock would be a safe option?
0
Shinu
Top achievements
Rank 2
answered on 25 Feb 2014, 05:57 AM
Hi,

RadCodeBlock and RadScriptBlock are used to allow server and client script to work well together with AJAX updates. RadCodeBlock should be used when you have server code blocks placed within the markup. RadScriptBlock is used where you have JavaScript that evaluates after an AJAX request. Please have a look into this help documentation for further information.

Thanks,
Shinu.
0
sglad007
Top achievements
Rank 1
answered on 25 Feb 2014, 06:43 PM
Shukriya [Thanks so much] Shinu,
    This helped immensely in my understanding of the two. 

    One more question:
    Can either of them nest the other? Any negative implications etc.? [Just picking your brain]


Thanks,
SGlad007
0
Maria Ilieva
Telerik team
answered on 27 Feb 2014, 12:24 PM
Hello,

You should not nest RadScriptBlock into RadCodeBlock or vice verse. the both modules could contains only properly formatted script tags.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Ajax
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Vlad
Telerik team
sglad007
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Maria Ilieva
Telerik team
Share this question
or