Sorangwala Abbasali Sorangwala Abbasali - 1 year ago 46
C# Question

Trouble in using bootstrap for mvc4 application

As i am a web developer and very fresh to mvc. I am having trouble to use bootstrap with View part. I added Links of MaxCDN to _Layout file. But was not able to get access to it. As i am restricted to internet in office i am stuck.

Help me out to get classes of bootstrap same as we get those in front-end of simple web application in visual studio.

Update: I tried adding Bootstrap Css package from NuGet in VS12.

Answer Source

Get a Local Copy of Bootstrap

If you can't access Bootstrap from the CDN, you'll need to pull it in via NuGet or your preferred package manager (npm, bower, etc.). This will download the files into your solution so that they don't require any external connections.

Additionally, you can download Bootstrap directly if you would prefer that approach.

Reference the Local File

Once you have it in your solution, you'll just need to reference it by location within the <head> section of your _Layout.cshtml file:

<!-- Point to the location within your solution that Bootstrap is stored -->
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />

Or you can simply drag-drop it from your Solution Explorer :

enter image description here

If you are still encountering issues, consider checking the Developer Tools (F12) within your browser and clearing your cache to ensure the latest files are being pulled properly.