Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8391417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:15:20+00:00 2026-06-09T19:15:20+00:00

when I created my project with the standard MVC4 template, there was ALOT of

  • 0

when I created my project with the standard MVC4 template, there was ALOT of javascript included, e.g: jquery-obtrusive, jquery-validate, knockout, the entire jQuery UI.

How much of this is worth keeping and how much is throw away? I’ve noticed when you create a strongly typed Controller the create.cshtml view generated calls:

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

What exactly does this file do? Should I keep it? Should I reference all of these JS files that were initially defined in BundleConfig.cs? Or can I not bother..?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:15:22+00:00Added an answer on June 9, 2026 at 7:15 pm

    What exactly does this file do?

    jqueryval is not a file it is a reference to a bundle.

    A bundle in MVC4 is a collection of scripts, styles or other files bundled together into a single bundle.

    You will have a BundleConfig.cs file in the App_Start folder, which contains the settings of which file is added to which bundle.

    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                "~/Scripts/jquery.unobtrusive*",
                "~/Scripts/jquery.validate*"));
    

    As you can see above ~/bundles/jqueryval is the virtual path of the bundle which combines the files specified in it. So later on when you see this:

    @section Scripts {
        @Scripts.Render("~/bundles/jqueryval")
    }
    

    The above will include the scripts bundled under that reference.

    Should I keep it? Should I reference all of these JS files that were
    initially defined in BundleConfig.cs?

    In the case of the jqueryval bundle you might find that the unobtrusive and validation scripts included are very useful.

    They are the scripts which will take care of managing unobtrusive validation, keeping your DOM nice and clean.

    You can remove the bundle off course if you don’t need or want to use unobtrusive validation. If you do that then I believe you will also need to update your web.config, setting the required fields to false to ensure your project will not be looking for the files, similar to this:

    <add key="ClientValidationEnabled" value="false" />
    <add key="UnobtrusiveJavaScriptEnabled" value="false" />
    

    The benefit and exact difference between using obtrusive and unobtrusive validation is explained very well in this article: Brad Wilson: Unobtrusive Client Validation in ASP.NET MVC 3

    In general, I would assume it is good to only include what you need. If you don’t need all the files specified in a bundle, remove those files, exclude the bundle all together or create your own custom bundles.

    Trial and error. If you remove them and find random exceptions in your browser debugger console, try adding some of the files/bundles back in.


    In general, bundling also works with style-sheets:

    bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                "~/Content/themes/base/jquery.ui.core.css",
                "~/Content/themes/base/jquery.ui.resizable.css",
                "~/Content/themes/base/jquery.ui.selectable.css",
                "~/Content/themes/base/jquery.ui.accordion.css",
                "~/Content/themes/base/jquery.ui.autocomplete.css",
                "~/Content/themes/base/jquery.ui.button.css",
                "~/Content/themes/base/jquery.ui.dialog.css",
                "~/Content/themes/base/jquery.ui.slider.css",
                "~/Content/themes/base/jquery.ui.tabs.css",
                "~/Content/themes/base/jquery.ui.datepicker.css",
                "~/Content/themes/base/jquery.ui.progressbar.css",
                "~/Content/themes/base/jquery.ui.theme.css"));
    

    The benefit to the developer is only having to reference an individual bundle instead of several files.

    The benefit to the client is how many individual loads the browser has to do to get the scripts/css files.

    If you for example have 5 files references in your view the client browser will download all 5 separately and there is a limit in each browser how many files can be downloaded simultaneously. This means that if a client has a slower connection they could wait a few seconds before the files are loaded.

    However, if you have all 5 files configured to be in a single bundle, the browser only downloads 1 file, the bundled one.

    In addition the bundles are minified (or the files in the bundles) so you are not only saving on time it takes to download the scripts but you also save on download size.

    When you test this, note in debug mode is no difference, you need to be in release mode or enable optimization of the bundle table in the BundleConfig.cs file at the bottom of the RegisterBundles method.

    BundleTable.EnableOptimizations = true;
    

    You don’t have to use the bundles, you still can freely reference individual scripts/css files. It does makes things easier though when you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just created my first MVC2 project using the standard template. I need to
A standard spring web application (created by Roo or Spring MVC Project Template) create
I installed the MVC 4 beta and created a new project. The standard template
I have created an asp.net mvc2 project using the standard visual studio template which
I am trying to make aSmack work in my project. Created a standard project
info: xcode 4.3.2, iOS5, using storyboard. Created project from xcode's Tabbed Application template. Did:
Im trying to create an outlook 2010 addin. I just created the standard project,
I have a standard sql server 2008 project which has been created using vs2010.
I have taken a project based on the standard iPad SplitViewerController template and implemented
I created a standard c++ library project and I tried to include <tuple> but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.