Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • MVC styling and Scripting

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 325
    Comment on it

    In the design page if you want to add libraries for script files and CSS files so for doing that in MVC architecture you need to use two tags :

    1 Styles.Render

    2 Scripts.Render


    Style.Render is used to add bundle of CSS files. Styles.Render create style tag for the CSS.

    Scripts.Render is also used to add all Script files by searching script tag for the Script .


    Here is the example:


      /*  This is the repository for all the script files  */


      public class BundleConfig
         public static void RegisterBundles(BundleCollection bundles)
         bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
         /*  This will include the reference of all the library files into your application */ 
         bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(



    So we have the class which contain all the collection of the script files to include these references into your project



    @*@section Scripts {


    You need to add it into your view if you want to apply it on single view.



    If you want to make it global for all view add it in the Layout.cshtml which is in View shared folder.




 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: