RadCodeBlock and RadScriptBlock

6 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 26 Nov 2008 Link to this post

    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.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Nov 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. sglad007
    sglad007 avatar
    2 posts
    Member since:
    Oct 2012

    Posted 24 Feb 2014 in reply to Vlad Link to this post

    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?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Feb 2014 in reply to sglad007 Link to this post

    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.
  6. sglad007
    sglad007 avatar
    2 posts
    Member since:
    Oct 2012

    Posted 25 Feb 2014 in reply to Shinu Link to this post

    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
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Feb 2014 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017