Book Image

Bootstrap for ASP.NET MVC - Second Edition

By : Pieter van der Westhuizen
Book Image

Bootstrap for ASP.NET MVC - Second Edition

By: Pieter van der Westhuizen

Overview of this book

One of the leading open source frontend frameworks, Bootstrap has undergone a significant change and introduced several features that make designing compelling, next-generation UIs much simpler. Integrating Bootstrap with ASP.NET's powerful components can further enhance its capabilities. This book guides you through the process of creating an ASP.NET MVC website from scratch using Bootstrap. After a primer on the fundamentals of Bootstrap, you will learn your way around and create a new ASP.NET MVC project in Visual Studio. You will move on to learn about the various Bootstrap components as well as techniques to include them in your own projects. The book includes practical examples to show you how to use open-source plugins with Bootstrap and ASP.NET MVC and guides you through building an ASP.NET MVC website using Bootstrap, utilizing layout and user-interface components. At the end of this book, you will find some valuable tips and tricks to help you get the most out of your Bootstrap-integrated and ASP.NET MVC-integrated website.
Table of Contents (15 chapters)
Bootstrap for ASP.NET MVC Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Preface

Twitter Bootstrap, known simply as Bootstrap, is the leading open source CSS/HTML and JavaScript framework on the Internet. Shortly after its launch, it was the most popular project on GitHub. It is so popular that Microsoft announced at their Build 2013 conference that all the web app project templates in Visual Studio 2013 will use Twitter Bootstrap by default.

One of the main reasons Bootstrap is so prevalent is that it allows developers, many of whom are notoriously bad at user interface design, to build aesthetically pleasing sites with a relatively small amount of effort. Bootstrap also offers a rich ecosystem of free and commercial templates, third-party components, tools, and an active and helpful community.

Using CSS Frameworks and Bootstrap in particular with ASP.NET MVC is a natural fit. Bootstrap takes care of the typography, form layouts, and user interface components, which allows the developer to focus on what they are good at – writing code.  This aspect is particularly valuable for smaller development companies who do not necessarily have an in-house designer.

.NET Core is a new and exciting framework written from the ground up. It can be used to develop a variety of applications, not just web applications. It promises the ability to target different platform, such as Linux and Mac as well as smaller deployment footprints. ASP.NET Core has been built upon the .NET Core and is a rewrite of the ASP.NET platform .NET developers have known for many years.

What this book covers

Bootstrap for ASP.NET MVC walks you through the process of creating a fully functioning ASP.NET MVC website, using Bootstrap for its layout and user interface.

Chapter 1, Getting Started with ASP.NET Core and Bootstrap 4, introduces you to the files in the Bootstrap 4 distribution, creating an empty ASP.NET site as well as providing an introduction to using Bower and Gulp.

Chapter 2, Using Bootstrap CSS and HTML Elements, examines all the various Bootstrap CSS and HTML elements, how to include them in your ASP.NET MVC project, and how to configure and use their various options.

Chapter 3, Using Bootstrap Components, makes you familiar with the Bootstrap navigation bar, button groups, alerts, and introduces you to cards.

Chapter 4, Using Bootstrap JavaScript Components, guides you through creating cascading dropdowns, modal dialogs and accordions.

Chapter 5, Creating MVC Bootstrap Helper and Tag Helpers, teaches you to create a Bootstrap MVC helper as well as a Tag Helper introduced with ASP.NET Core.

Chapter 6, Converting a Bootstrap HTML Template into a Usable ASP.NET MVC Project, converts an open source HTML template and makes it ready to be used with ASP.NET MVC.

Chapter 7, Using the jQuery DataTables Plugin with Bootstrap 4, demonstrates how to use the powerful jQuery DataTables plugin with Bootstrap and ASP.NET in order to show tabular data.

Chapter 8, Creating Bootstrap 4 ASP.NET MVC Sites Using Visual Studio Code, shows you how to use the free Visual Studio Code editor to create ASP.NET projects.

Appendix, Bootstrap Resources, gives you a list of Bootstrap resources available on the Internet.

What you need for this book

To get the most out of this book, you’ll need Visual Studio 2015 and a modern browser. All examples have been tested with Visual Studio 2015, Google Chrome, and Mozilla Firefox. The book would be beneficial to those with entry-level up to advanced-level experience of ASP.NET MVC development, as well as limited experience in Bootstrap.

Who this book is for

This book is for ASP.NET MVC developers who would like to know how to incorporate Bootstrap into their projects. ASP.NET MVC developers could also benefit from the chapters covering advanced topics, such as creating helpers and using the jQuery Data-tables plugin. If you have limited experience with ASP.NET MVC and Bootstrap, this book can serve as a primer to these technologies.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Double-click on the project.json file inside the Solution Explorer in Visual Studio"

A block of code is set as follows:

public void ConfigureServices(IServiceCollection services) 
         { 
            services.AddMvc(); 
         }

Any command-line input or output is written as follows:

npm install -g yo grunt-cli generator-aspnet bower 

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Select the Empty project template from the New ASP.NET Core Web Application (.NET Core) Project dialog window and click on OK"

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from https://github.com/Pietervdw/bootstrap-for-aspnetmvc or from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/BootstrapforASPNETMVC_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.