0

i have a form of the Grille Table: when adding a new object in my form :my modelState.isValid is set to false. i tried to identify the error by adding this method:

if (!ModelState.IsValid)
{
    var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception));
    // Breakpoint, Log or examine the list with Exceptions.
}

and the error message was just "*" i didn't know how to fix it and exactly in which folder i must search my error ??

enter image description here

ODE
  • 285
  • 5
  • 22
  • 1
    see http://stackoverflow.com/a/4934712/961526 (and following answer if you want the error message) – Raphaël Althaus May 12 '14 at 15:11
  • Check any Model validations are failing i.e DataAnnotations like Required/Range – malkam May 12 '14 at 15:15
  • @malkam i check DataAnnotations and i fixed my attribute which was with a incorrect required annotation,thanks my **modelsatate.isvalid** is true now.even i fixed my modelstate problem now i have an INTERCEPTION DE CONSTARINTEXCEPTION when to save my form after adding a new object what is this exception? when i put a brikpoint i found that the object i have added is null why is that?? – ODE May 12 '14 at 15:26

1 Answers1

0

on your break point on line 125 do a Quick Watch on ModelState and go through the Values to find which one(s) have the error flag set.

Link from raphael will help.

SkyBlues87
  • 1,196
  • 9
  • 17
  • i have done that and i found the error by going through the values @SkyBlues87 thanks – ODE May 12 '14 at 15:28