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

[Solved] Change Default Asset Directory

4 Answers 152 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nathan Taylor
Top achievements
Rank 1
Nathan Taylor asked on 09 Jun 2010, 03:08 AM
I've been looking around the documentation and forums for a way to change the default directory that the ScriptRegistrar and StyleSheetRegistrar look in for an asset. My website does not use the default ~/Js and ~/Content directories and I get an exception as soon as I call Html.Telerik().ScriptRegistrar() because the statement implicitly looks for ~/Scripts/telerik.common.js, which is actually located in ~/Content/Js/telerik in my application.

Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 09 Jun 2010, 11:33 AM
Hello Nathan Taylor,

You need to set the required path using WebAssetGroup DefaultPath method. Here is code snippet showing how to achieve your goal:
<%= Html.Telerik().ScriptRegistrar()
                 .DefaultGroup(group => group.DefaultPath("~/Content/Js")) %>

Kind regards,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nathan Taylor
Top achievements
Rank 1
answered on 09 Jun 2010, 03:12 PM
Damn. How did I miss that.

Thank you :)
0
Nathan Taylor
Top achievements
Rank 1
answered on 09 Jun 2010, 05:07 PM
How do I delete a post?
0
Sysdata Labs
Top achievements
Rank 1
answered on 10 Nov 2010, 10:24 PM

I am trying to "localize" the .css and .js files used for the TabStrip extension since some or our employee's are not allowed to access external sites. I have followed the following steps to ensure all css calls are hitting a local libary with the following code ... 

<% Html.Telerik().StyleSheetRegistrar().StyleSheets(sheet => sheet
    .Add("~/Content/2010.2.825/telerik.common.min.css")
    .Add("~/Content/2010.2.825/telerik.black.min.css")
    .Add("~/Content/Site.css"))
    .Render(); %>


 

When I try and do the same thing to the js files, with the following code ...

<% Html.Telerik().ScriptRegistrar().Scripts(script => script
    .Add("~/Scripts/2010.2.825/jquery-1.4.2.min.js")
    .Add("~/Scripts/2010.2.825/telerik.common.min.js")
    .Add("~/Scripts/2010.2.825/telerik.tabstrip.min.js"))
    .Render(); %>



I get the following in my source ...

<script type="text/javascript" src="/Scripts/2010.2.825/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.common.min.js"></script>
<script type="text/javascript" src="/Scripts/2010.2.825/telerik.tabstrip.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#TabStrip').tTabStrip({effects:{list:[{name:'property',properties:['height','opacity']}],openDuration:200,closeDuration:300}});});
//]]>
</script>


Why do both the Telerik and local js libaries attempt to load if I am not using the "DefaultGroup" call? Thanks!

Tags
General Discussions
Asked by
Nathan Taylor
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Nathan Taylor
Top achievements
Rank 1
Sysdata Labs
Top achievements
Rank 1
Share this question
or