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

Moving RadCodeBlock code into External Files

1 Answer 77 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 06 Jun 2012, 02:31 PM
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.

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 06 Jun 2012, 03:24 PM
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.

Regards,
Vasil
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.
Tags
Ajax
Asked by
Eric
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or