0

The error is :The type arguments for method 'System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor..........' cannot be inferred from the usage.Try specifying the type arguments explicitly.

      <div class="form-group">
      <label for="email">Email address</label>
      <input type="email" class="form-control" id="email" aria- 
      describedby="emailHelp">
      <small id="emailHelp" class="form-text text-muted">We'll never share 
       your email with anyone else.</small>
       <label class="text-danger">@Html.ValidationMessageFor(model => 
       model.Email)</label>
       </div>
Pacman
  • 11
  • 5
  • Does your `*.cshtml` file have a `@model TypeNameGoesHere` statement? What is the full type-name of `this.Html`? Does your View-Model type have a property named `Email`? – Dai Apr 26 '20 at 09:25
  • Yes, the *.cshtml file has the statement @model TimeTracking.Models.login . The name of the Html file is index.cshtml . And the code in the model is : public partial class login { public int Id { get; set; } [Required(ErrorMessage ="This field is required")] public string Email { get; set; } [Required(ErrorMessage = "This field is required")] public string password { get; set; } public String LoginErrorMessage { get; set; } } – Pacman Apr 26 '20 at 09:29
  • Clean and Rebuild your project and maybe restart Visual Studio, it could be a caching issue. – Dai Apr 26 '20 at 09:30
  • Done it multiple times.No progress. – Pacman Apr 26 '20 at 09:33
  • What are the type arguments and how can we specify them explicitly? – Pacman Apr 26 '20 at 09:35

0 Answers0