@if + lambda in an editor template
-
31-10-2019 - |
문제
I have something for which I can't find the right syntax:
/Views/Shared/EditorTemplates/Component.cshtml
@model Website.Models.Component
<div class="editor-field">
@if (x => x.Name == "")
{
@Html.EditorFor(x => x.Name)
<button class="create">New</button>
}
else
{
@Html.DisplayFor(x => x.Name)
<button class="delete" value="@Model.Id">X</button>
}
</div>
I hope the intention is clear... how do I get there (it's hard to google for this sort of thing)?
올바른 솔루션이 없습니다
제휴하지 않습니다 StackOverflow