How do I access the ModelState from within my View (aspx page)?
Asked
Active
Viewed 3.4k times
126
1 Answers
195
-
22Also worthy to note that you can just do `ViewData.ModelState` and if you want to display some conditional markup on errors you can do like this: `@if (!ViewData.ModelState.IsValid)` – The Muffin Man Sep 15 '13 at 02:16
Your message was not sent. Please correct the errors below and try again.
<% } %> Instead I want to do this: <% if (!ViewData.ModelState.IsValid) { %>Your message was not sent. Please correct the errors below and try again.
<%} %> – Saajid Ismail Jun 26 '09 at 13:44