Moving RadCodeBlock code into External Files

2 posts, 0 answers
  1. Eric
    Eric avatar
    32 posts
    Member since:
    Jun 2011

    Posted 06 Jun 2012 Link to this post

    How can I move RadCodeBlocks into an external .JS file? It seems like when I do, the <%= XXXX.ClientID %> formatting doesn't get parsed correctly.
  2. Vasil
    Vasil avatar
    1642 posts

    Posted 06 Jun 2012 Link to this post

    Hi Eric,

    You can use inline asp tags only in asp files. So if you have such tags in your JS you will need to rewrite in such a way that not to use them, and only then you will be able to place the code inside external file.

    I see several options for doing that:
    1. Use global variables in the JS of your asp page that to holds the value calculated by the inline tags. And then later use these variables in the external js file.
    2. Do not use these tags at all. Use events of the controls and store the "sender" into some variables when needed.
    3. Use directly the ID of the controls when you know them and they are not dynamically set.

    You can write us some examples in which you use these tags, and we could try to point you some workarounds for the exact cases.

    the Telerik team
    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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top