Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
I have installed bootstrap from nuget manaer by right click the project->Manage nuget manager.

Bundle.config

C#
public static void RegisterBundles(BundleCollection bundles)
 {

     bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                 "~/Scripts/jquery-{version}.js"

   ));

     bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                 "~/Scripts/jquery-ui-{version}.js"
                 ));

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

     // Use the development version of Modernizr to develop with and learn from. Then, when you're
     // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
     bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                 "~/Scripts/modernizr-*"));


     bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
   "~/Scripts/bootstrap.min.js"));

     bundles.Add(new StyleBundle("~/Content/css").Include(
         "~/Content/bootstrap.min.css",
         "~/Content/bootstrap-theme.min.css"
         ));
 }



Layout.chtml

C#
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - My ASP.NET MVC Application</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @*@Styles.Render("~/Content/css")*@
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
        
        
    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
                </div>
                <div class="float-right">
                    <section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>
                    <nav>
                        <ul id="menu">
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>
                            <li>@Html.ActionLink("About", "About", "Home")</li>
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>© @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>
        
        @Scripts.Render("~/bundles/jquery")
        
        @RenderSection("scripts", required: false)
    </body>
</html>


What I have tried:

http://stackoverflow.com/questions/20869907/adding-bootstrap-in-bundleconfig-doesnt-work-in-asp-net-mvc


I tried this link,but i didnt get anything.
Posted
Updated 8-Mar-16 1:51am
v4
Comments
Richard Deeming 8-Mar-16 7:30am    
Well it doesn't look like you tried the link you posted - the .min is still present in your RegisterBundles method.

1 solution

use non minified version of bootstrap.css and bootstrap-theme.css in bundle
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900