jcrump / BootstrapNotifications

Notifications extension built with bootstrap for ASP.NET MVC projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BootstrapNotifications

Bootstrap Notifications is a controller extension built with bootstrap for ASP.NET MVC projects. It enables you to easily notify your users per request from the controller.

Screenshot of demo project

Installation

You can download it using the Package Manager Console:

 Install-Package BootstrapNotifications

or download it from NuGet

Alternatively, you can use the demo project from this repository.

Setup

  1. To use this extension, you'll need to include the shared partial where you plan on displaying the notifications. I would suggest above @RenderBody() in _Layout.cshtml.

    Example _Layout.cshtml:

     <div class="container">
         @Html.Partial("_Notifications")
         @RenderBody()
     </div>
    

    NOTE: make sure to include bootstrap in your layout.

  2. In any controller, include the NotificationExtensions and you can start notifying your users:

    Example HomeController.cs:

     using System.Web.Mvc;
     using YourApp.Extensions;
    
     namespace YourApp.Controllers
     {
         public class HomeController : Controller
         {
    
             public ActionResult Index()
             {
                 this.AddNotification("You're on fire, run!", NotificationType.ERROR);
                 return View("Index");
             }
         }
     }
    

    Screenshot of demo index code snippet

  3. You're ready to go!


The available NotificationTypes are:

About

Notifications extension built with bootstrap for ASP.NET MVC projects

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:HTML 38.5%Language:C# 26.4%Language:PowerShell 17.6%Language:Pascal 15.4%Language:CSS 1.9%Language:ASP 0.3%