title: How to execute a conditional alert on OnLoad MVC event
body: <p>I want to use Razor code inside a view section to show an alert if a condition is true. My code is:</p>
  
  <pre><code>@Section BodyAttributes
        @If (ViewData("condition") = True) Then
            onLoad = "alert('message')"
        End If
  End Section
  </code></pre>
  
  <p>I'm new to MVC world and I don't know how to write this. The comiler complains that onLoad is not declared.
  If I remove the condition, the code works fine and the alert box is shown.</p>