Home > Back-end >  How to do Date validation in Razor .Net Core
How to do Date validation in Razor .Net Core

Time:05-20

Need standard validations for Start and End Dates. Should include:

  1. End Date > Start Date.
  2. End Date < Today Date.
  3. Start Date < End Date

So far tried below approaches, but these do not work completely: enter image description here

Edit

[HttpPost]
        public IActionResult Time(Time modeo)
        {
            if (ModelState.IsValid)
            {
                // add your code here.....
                
                
            }
            //return model and error message
           return View(modeo);
        }
  • Related