title: Display ViewBag content in a dialog box view
body: <p>I am trying to show an alert message on submitting a request. The alert message should be the content of ViewBag. Here is my view. </p>
  
  <pre><code>@{
      ViewBag.Title = "Request";
      Layout = "~/Views/Shared/_Layout.cshtml";
   }
  
  @if (!string.IsNullOrEmpty(ViewBag.message))
  {
  
      &lt;script type="text/javascript"&gt;
          var msg = "@ViewBag.message";
          alert(msg);
      &lt;/script&gt;
  }
  </code></pre>
  
  <p>There is no alert even when ViewBag.message has value in it.</p>