locked
ModelState.AddFormError RRS feed

  • Question

  • User1519602350 posted

    I am not getting the below error. How can i resolve this one.

    Compiler Error Message: CS1955: Non-invocable member 'System.Web.WebPages.Html.ModelStateDictionary.IsValid' cannot be used like a method.

    Source Error:

    Line 68:             ModelState.AddFormError("One entry only possible");
    Line 69:         }
    Line 70: if (ModelState.IsValid()){
    Wednesday, July 3, 2013 4:38 PM

Answers

  • User-821857111 posted

    Remove the parentheses. IsValid is a property not a method:

    if(ModelState.IsValid){

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 3, 2013 4:49 PM