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

ScriptRegistrar looking for JQuery

13 Answers 583 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.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 09 Nov 2009, 02:17 PM
Hello,

I'm getting an error: Specified file does not exist: "~/Scripts/jquery-1.3.2.js".

I don't store the jquery script there, and don't want to.  Why is telerik looking for jquery here, and how can I change the path to look at the path in my application.

Thanks.

13 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 09 Nov 2009, 02:26 PM
Hi Brian Mains,

Our UI components depend on jQuery so by default the ScriptRegistrar is looking for it in its default location specified by the Mvc Application project template. You can do two things:
  1. Disable the automatic registration of jQuery:
    <%= Html.Telerik().ScriptRegistrar().jQuery(false) %>
  2. Change the location where jquery is to be found:
    <%= Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.DefaultPath("~/Location"))%>

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brian Mains
Top achievements
Rank 1
answered on 09 Nov 2009, 02:40 PM
OK, thanks.  In the second path, would that throw off anything else?  What I mean is that in my app, I use the folder structure

Content
    Scripts
         JQuery

And so I break out my scripts by source.  If other scripts are involved, I may put them in another folder, so I wasn't sure if specifying the default location would affect something else....

Thanks.
0
Atanas Korchev
Telerik team
answered on 09 Nov 2009, 02:57 PM
Hello Brian Mains,

Setting the default location should break anything else as far as I understand your question.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brian Mains
Top achievements
Rank 1
answered on 09 Nov 2009, 03:52 PM
Hey,

I assume the default group will also affect how it finds the telerik scripts.... I copied the telerik scripts into my application in ~/Scripts/Telerik, and set the default group to:

<%= Html.Telerik().ScriptRegistrar().jQuery(false).DefaultGroup((asset) =>
        {
            asset.DefaultPath("~/Scripts/Telerik");
        }) %>

But this doesn't work; it still looks for ~/Scripts/telerik.common.js.

Why?

Thanks.
0
Brian Mains
Top achievements
Rank 1
answered on 09 Nov 2009, 04:19 PM
Nevermind, I figured it out.  It's the webAssetDefaultSettings component, which has the ScriptFilesPath and StyleSheetFilesPath properties.
0
Kazi Manzur Rashid
Telerik team
answered on 10 Nov 2009, 01:27 PM
Hello Brian Mains,

I think we have a bug in the defaualt location. For time being please use the WebAssetDefaultSetting that you mention, we will be soon releasing a patch which should fix this issue.

All the best,
Kazi Manzur Rashid
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kaleem Khan
Top achievements
Rank 1
answered on 16 Dec 2009, 09:18 PM
I was wondering if the bug already been fixed. If yes, how can I get the fix as I dont see any recent builds. thanks.
0
Kazi Manzur Rashid
Telerik team
answered on 21 Dec 2009, 12:19 PM
Hi Kaleem Khan,

Yes, this has been fixed in the Service Pack1 which we have releasaed few days ago. I think it is already available in our client  download section.


All the best,
Kazi Manzur Rashid
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Edward
Top achievements
Rank 1
answered on 02 Aug 2011, 04:16 PM
Sorry to kick this thread, but I'm now seeing the error:

Specified file does not exist: "~/scripts/Telerik/jquery.validate.js".


We haven't seen it before as we are only now introducing editing to our grids.

We have the telerik js files in a separate directory to other js libraries, and so have already had to disable jQuery. This has worked for the jQuery script, but not for the jquery validate file (we also have this in a separate directory).

@(Html.Telerik().ScriptRegistrar()
    .DefaultGroup(group => group.DefaultPath("~/scripts/Telerik/"))
    .jQuery(false)
    .jQueryValidation(false)
)

Any suggestions would be much appreciated.
0
Dimo
Telerik team
answered on 03 Aug 2011, 08:16 AM
Hi Edward,

I am not able to reproduce the described issue, no matter whether I set .jQueryValidation(false) or .jQueryValidation(true).

The exception occurs *only* if  jQueryValidation is set to true and the validation script file is not in ~/scripts/Telerik/.

You can send us a simple runnable demo if the problem persists.

Best wishes,
Dimo
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
Edward
Top achievements
Rank 1
answered on 03 Aug 2011, 09:52 AM
Please accept my apologies.

This does indeed work  - the script registrar code that I was changing was the wrong block of code.

We have now cleaned up our project to ensure we are calling the script registrar once in a layout file.

Thanks for your response.
0
Young
Top achievements
Rank 1
answered on 26 Nov 2012, 04:16 AM
I changed to default path of all the js file following your recommendation but I still got 404 error even though I also got 200 OK message by Fiddler.
Here is my layout.cshtml file to call js files.

 @Html.Telerik().ScriptRegistrar().jQuery(true)
     @Html.Telerik().ScriptRegistrar().DefaultGroup(group => group
                    .Add("http://aspnet-scripts.telerikstatic.com/mvcz/2012.2.607/telerik.common.min.js")
                    .Add("http://aspnet-scripts.telerikstatic.com/mvcz/2012.2.607/telerik.textbox.min.js")
                    .Add("http://aspnet-scripts.telerikstatic.com/mvcz/2012.2.607/telerik.calendar.min.js")
            )
    
But I got both 200 and 404, which is twice of message found from Fiddler.

"NetworkError: 404 Not Found - http://localhost:30320/VGIWeb/Scripts/2012.2.607/telerik.common.min.js"
teleri....min.js
"NetworkError: 404 Not Found - http://localhost:30320/VGIWeb/Scripts/2012.2.607/telerik.textbox.min.js"

My question is why I got this errors even though I turn off the default registration of all the js files from Telerik's 2012.2.607 folder locally? why still try to load local js files after jQuery(false)? I have only one location to set @Html.Telerik().ScriptRegistrar() in my Orchard project. Thanks.


0
Young
Top achievements
Rank 1
answered on 26 Nov 2012, 04:28 AM
Found a solution by:

<%= Html.Telerik().ScriptRegistrar()
                 .DefaultGroup(group => group.DefaultPath("~/Content/Js")) %>

I changed default location of js files and works fine now.
Tags
General Discussions
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Brian Mains
Top achievements
Rank 1
Kazi Manzur Rashid
Telerik team
Kaleem Khan
Top achievements
Rank 1
Edward
Top achievements
Rank 1
Dimo
Telerik team
Young
Top achievements
Rank 1
Share this question
or