If you want to give feedback of an action to user (like the way validationsummary does), you should use AlertResult.

  • AlertType : Type of alert (Info, Success, Warning, Error)
  • title: title
  • description: message to display

In your controller you could write:
        public ActionResult About()
            ViewResult view = View();
            return new AlertResult<ViewResult>(view, AlertType.Info, "Some title", "Some description");

        public ActionResult About()
            return View().AndAlert(AlertType.Info, "Some title", "Some description");

Second example is the better

Now in your view, you can use:
        <div class="page">

In order to work properly, you will have to create a view named _Alert.cshtml in your views/shared folder.
@model Alert
<div id="flash" class="alert alert-@Model.AlertType.ToString().ToLower()">
    <strong class="alert-heading">@Model.Title</strong>

Last edited Jun 12, 2013 at 11:15 AM by jefflequeux, version 3


No comments yet.