Monday, 30 October 2017

MVC - How to get all validation error in Controller (after postback)

Watch on YouTube


      
 [HttpPost]
        public ActionResult TestValidations(SelectOrders_Result model)
        {
            foreach(ModelState m in ViewData.ModelState.Values)
            {
                foreach(ModelError er in m.Errors)
                {
                    string errMess = er.ErrorMessage.ToString();
                }
            }

No comments:

Post a Comment