Ich möchte zwei Felder verketten und alle Elemente einer Datenbankklasse auflisten. Warum kann ich mit der Listenmethode Entity framework
und ASP.Net MVC
so etwas nicht machen?Entity Framework 5: Verketten Sie zwei Felder
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.FName + " " + item.Lname)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.CustomerID }) |
@Html.ActionLink("Accounts", "Accounts", new { id=item.CustomerID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.CustomerID })
</td>
</tr>
}
bekomme ich folgende Fehlermeldung:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'Customer' does not contain a definition for 'Lname' and no extension method 'Lname' accepting a first argument of type 'Customer' could be found (are you missing a using directive or an assembly reference?)
Wie dies umgehen?