jquery and bootstrap hassles…

 

 

Had an issue the other day where I was creating a new project (part of spring cleanup!) and adding in security like I wanted. Then this bad boy came around:


‘jquery’ is not a valid script name.  The name must end in ‘.js’.

Hmmm. What causes this?

 

Look at Global.asax – see the BundleConfig pointer?

 

So, this gives us our starting place. We need to make changes to BundleConfig.cs (under App_Start) and the Site.Master page.

 

So for example to add a “bootstrap” name we can point to in our site master, we use the following snippet:


ScriptManager.ScriptResourceMapping.AddDefinition(“bootstrap”, new
ScriptResourceDefinition

{

Path = “/scripts/bootstrap.min.js”,

DebugPath = “/scripts/bootstrap.js”,

LoadSuccessExpression = “bootstrap”

});

 

Now in Site.Master the following ScriptReferences should work with no errors:

 

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.