임금이 만료 된 행이나 만료일이 30 일인 행을 강조 표시하려고합니다. 내가 이것을 빌드하면 ... does not contain Definition for the ".Days"
이라고합니다. 이 새로운 메신저"Days"에 대한 정의가 누락되었습니다
그렇게 그게 왜이 오류를 얻고있다 Days
의 정의를 포함하지 않는 Nullable<TimeSpan>
객체를 반환합니다 PaidDate
으로
@foreach (var item in Model)
{
int daysLeft = (item.MembershipType.PaidDate - DateTime.Today).Days;
string style = daysLeft <= 30 ? "background-color:Red" : null;
<tr style="@style">
<td>
@Html.DisplayFor(modelItem => item.SupplierName)
</td>
<td>
@Html.DisplayFor(modelItem => item.MembershipType.PaidDate)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
@Html.ActionLink("Details", "Details", new { id = item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id })
</td>
</tr>
}
'PaidDate'의 유형은 무엇입니까? –
PaidDate의 유형은 DateTime입니다 – anfield8
정확히 무엇을 찾고 계십니까? – MarmiK