IEnumerableItemMV does not contain a definition for SecId and no accessible extension method SecId accepting a first argument of type IEnumerableItemMV could be found
Here is Model
public class ItemMV
{
public int CodeItem { get; set; }
public string? Descriptionitem { get; set; }
public string? BaleSize { get; set; }
public int? Weight { get; set; }
public int? SecId { get; set; }
[DisplayName("Section")]
public string? Secnam { get; set; }
[DisplayName("Category")]
public string? Cname { get; set; }
public string? Packsize { get; set; }
public string? Alid { get; set; }
public int? Iduom { get; set; }
[NotMapped]
public IEnumerable<SelectListItem>? Listofsections { get; set; }
}
View
@model IEnumerable<Used_Clothing_Managment.Models.ListView.ItemMV>
@{
ViewBag.Title = "Item List";
}
<div class="card-body">
@* @Html.ActionLink("Create Department", "CreateDepartment", null, new { @class = "btn btn-primary" })*@
<a asp-action="Create" class="btn btn-primary" asp-controller="Items">
Create New
</a>
<hr />
<form asp-action="Create">
{
<div class="form-group">
<div class="alert-danger" asp-validation-summary="ModelOnly"></div>
<label asp-for="SecId">Section</label>
<select asp-for="SecId"
class="form-select-sm form-control" data-live-search="true"
asp-items="@(new SelectList(Model.Listofsections,"Value", "Text") )">
</select>
</div>
}
</form>
<table class="table table-striped my-4 w-100" id="datatable2">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.CodeItem)
</th>
<th>
@Html.DisplayNameFor(model => model.Descriptionitem)
</th>
<th>
@Html.DisplayNameFor(model => model.Secnam)
</th>
<th>
@Html.DisplayNameFor(model => model.Cname)
</th>
<th>
@Html.DisplayNameFor(model => model.BaleSize)
</th>
<th>
@Html.DisplayNameFor(model => model.Weight)
</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@if (Model != null && Model.Any())
{
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.CodeItem)
</td>
<td>
@Html.DisplayFor(modelItem => item.Descriptionitem)
</td>
<td>
@Html.DisplayFor(modelItem => item.Secnam)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cname)
</td>
<td>
@Html.DisplayFor(modelItem => item.BaleSize)
</td>
<td>
@Html.DisplayFor(modelItem => item.Weight)
</td>
<td>
@* @Html.ActionLink("Edit", "Edit", new { dept_id = item.SecId }, new { @class = "btn btn-warning" }) |
@Html.ActionLink("Delete", "Delete", new { dept_id = item.SecId }, new { @class = "btn btn-danger" }) |
*@
<a asp-action="Edit" asp-route-id="@item.CodeItem" class="btn btn-warning">Edit</a> |
<a asp-action="Delete" asp-route-id="@item.CodeItem" class="btn btn-danger">Delete</a>
</td>
</tr>
}
}
else
{
<tr>
<td colspan="6">
<div>
No Employee Data is available..
</div>
</td>
</tr>
}
</tbody>
</table>
</div>