TechBubbles Microsoft Technology BLOG

Bootstrap for ASP.NET Development

It is critical for the web developers to target their websites to render on different devices and form factors. ASP.NET templates now using a framework called Bootstrap. What is Bootstrap? Bootstrap is front-end framework for easy and faster web development. This post explains how to use Bootstrap in  ASP.NET applications and outlines some of the features of this framework. Create a new ASP.NET project in Visual Studio 2013 and execute it then you will see the look and feel of the page as below.

image

If you want to get the above look without using Bootstrap then you have to write lot of custom CSS. Now all ASP.NET default templates like MVC, Web forms, Single Page applications and Web API are using Bootstrap framework. Bootstrap version 3 is integrated in Visual Studio 2013. The above screen scales well on different devices. If you look at the CSS code to achieve is very few lines as shown below

image

In order to get the Bootstrap into your project, go to Manage NuGet packages window and type Bootstrap in search box then you will find the package

image

once you install the package then it brings the following files into your project, All the CSS and JavaScript files related Bootstrap framework are bundled for you to get you better performance.

image

Another integration feature for Bootstrap is Bootswatch, which helps you to theme your site. To apply theme to your site go to Bootswatch site and choose the theme which you like and download and copy the CSS and overwrite the  Bootstrap.css in your project. After applying one of the sample free theme then the site looks as below, In matter of seconds you can quickly change the theme of your site.

image

Bootstrap works with grid layout. The above page is divided into 3 columns of width 4 each and it is very easy to change the layout of the page using CSS

image

if you want to change the layout of the page just change grid sizing something from value “col-md-4” to “col-md-6”. Make sure three columns added up to 12.

Another key feature of Bootstrap is dealing with the images, it makes the image experience as responsive without writing any code! just use the class name “img-responsive”.

image

It adds the responsive behaviour to the image and it make sure to render nicely in your site.

Another common requirement is styling the tables, If you use the class name table it will give you the outline to your table, you can add borders to table with class name table-bordered.

image

Bootstrap also has a nice feature called Glyph icons, for example if you want to add envelope to your support e-mail address then you can use class name glyphicon-envelope

imageimage

more on the Bootstrap CSS class names and tutorials can be read from here

About the author

Kalyan Bandarupalli

My name is kalyan, I am a software architect and builds the applications using Microsoft .NET technologies. Here I am trying to share what I feel and what I think with whoever comes along wandering to Internet home of mine.I hope that this page and its contents will speak for me and that is the reason I am not going to say anything specially about my self here.

1 Comment

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud