This project is read-only.


  • Visual Studio with ASP MVC


  1. Import the CSS style definitions from styles.css
    1. <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
  2. Import the js file notifications.js
    1. <script src="@Url.Content("~/Scripts/notifications.js")" type="text/javascript"></script>
  3. Include the logic from the NotificationsQueue.cs and UserNotification.cs
  4. Include DisplayHelper.cs - the helper method that we will use to generate client side code from the c# models.


 In the controller create your notifications  (or do this any other way):

    public class HomeController : Controller
        public ActionResult Index()

            NotificationQueue queue = new NotificationQueue(NotificationPosition.inline);
            queue.Notifications.Add(new UserNotification("Welcome! Here is your first notification! This message will selfdistruct in about 4 seconds ;)", NotificationType.Info, 10000));
            queue.Notifications.Add(new UserNotification("Error! Something bad has happened!", NotificationType.Error));

            ViewBag.q = queue;

            return View();

Next, that we have the notifications in our ViewBag, we need to render them in our View by calling the helper method , its as simple as :


 And the end result will be rendered like :

Rendered example


Last edited Jul 16, 2012 at 8:05 AM by alexpeta, version 4


No comments yet.