title: How can I check ModelState.IsValid from inside my Razor view
body: <p>I have the following in my action method:</p>
  
  <pre><code>       if (!ModelState.IsValid)
          return View(vm);
  </code></pre>
  
  <p>In the view I want to not present a submit key to allow deletion if the model state is not valid. Is there a way that I can do this? Is model state available in the view?</p>
  
  <p>Update: I have implemented this based on the answers I was given:</p>
  
  <pre><code>            &lt;div class="adm_td0" style=" padding: 0;"&gt;  
              @if (ViewData.ModelState.IsValid) {
                  &lt;input type='submit' value='Delete' name='SubmitAction' /&gt;
              }
                  &lt;input type='submit' value='Cancel' name='SubmitAction' /&gt;
              &lt;/div&gt;
  </code></pre>