There is a small form:

@model IEnumerable<Store.Web.ViewModels.CustomerViewModel> <h2>Create Customer</h2> <div class="row"> <div class="col-md-4"> <form asp-action="Create" asp-controller="Customer"> <div class="form-group"> <label asp-for="Name" class="control-label"></label> <input type="text" asp-for="Name" class="form-control" /> </div> <div class="form-group"> <input type="submit" value="Create" class="btn btn-primary" /> </div> </form> </div> </div> 

How to correctly identify the Name in the specified lable?

label asp-for = "Name"

but an error occurs:

It is not necessary to define a n name acce '' no no no

  • Try this @model Store.Web.ViewModels.CustomerViewModel - WebMorda
  • Since this is PartialView, an @model Store.Web.ViewModels.CustomerViewModel crashes. I detailed everything in the article. toster.ru/q/622344 , stackoverflow.com/questions/55673172/… - Gefest
  • You pass a list of objects, and try to work as with a single object. Because of this, the IEnumerable' does not contain a definition for 'Name' error IEnumerable' does not contain a definition for 'Name' . The problem is not in tag helpers, but in your model. If you want to work with a list, you need to go through it with a cycle @foreach (var item in Model){ } - WebMorda

0