[RESOLVED]MVC

Any One Please Help Me.. I add My Script Refrence in BundleConfig.cs and I add Bundle refrence in Master Page Mean _Layout.cshtml. But Jquery is not working in content Pages..

This is Bundle file..

bundles.Add(new ScriptBundle("~/Scripts/jquery").Include("~/Scripts/jquery-1.11.0.min.js", "~/Scripts/Script.js", "~/Scripts/jquery-ui.min.js"));

and this is my Master page …

@Scripts.Render("~/bundles/jquery", "~/bundles/jqueryval", "~/bundles/bootstrap")
@RenderSection("scripts", required: false)

Usman_Mughal

But Jquery is not working in content Pages..

How do you know that? Do you have an error?

Don’t add the "min" version of your scripts to the BundleConfig file.  Part of the bundling process is taking the original script and minifying it.

bundles.Add(new ScriptBundle("~/Scripts/jquery").Include(
    "~/Scripts/jquery-1.11.0.js", 
    "~/Scripts/Script.js", 
    "~/Scripts/jquery-ui.js"));

Should be this instead

Try looking at the console window of the browser to see the errors.

Also take a look at the view source of the page to see what javascript files are included.

In older versions of Bundle config, including min files don’t work (you need to explicitly mention that you intended to include the min files). What version of Bundle config you are using

The built-in Bundling and Minification will not recognize previously minified files unless explicitly configured to do so as mentioned in the Bunding and Minification Overview :

Note: Unless EnableOptimizations is true or the debug attribute in the compilation Element  in the Web.config file is set to false, files will not be bundled or minified.Additionally, the .min version of files will not
be used,
  the full debug versions will be selected. EnableOptimizations  overrides the debug attribute in the compilation Element  in the Web.config file.

I would also try using the Developer Tools (F12) within your browser and checking the Console area to see if there are any other specific errors that might be contributing to any other issues.

Leave a Reply