Tuesday, June 28, 2016

How can I check ModelState.IsValid from inside my Razor view

@if (!ViewData.ModelState.IsValid)
{
    <div>There are some errors</div>
<script>fun()<script>
}
function fun()
{
}