0
나는 다음과 같은 시나리오에서 VB 면도기 템플릿을 사용하는 데 문제가 있어요에서 클래스 값으로 VB 면도기 값을 사용할 수 없습니다 :이 코드 3. 대부분은 간단하다 내가 MVC 5 면도기를 사용하고TR
@ModelType IEnumerable(Of TrialLearning.Message)
@Code
ViewData("Title") = "Index"
End Code
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(Function(model) model.MessageTo)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.MessageFrom)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.Message1)
</th>
<th></th>
</tr>
@For Each item In Model
@Code
Dim readF As String = ""
If item.MessageRead = False Then
readF="info"
End If
End Code
<tr class="@readF">
<td>
@Html.DisplayFor(Function(modelItem) item.MessageTo)
</td>
<td>
@Html.DisplayFor(Function(modelItem) item.MessageFrom)
</td>
<td>
@Html.DisplayFor(Function(modelItem) item.Message1)
</td>
<td>
@Html.ActionLink("Edit", "Edit", New With {.id = item.MessageID}) |
@Html.ActionLink("Details", "Details", New With {.id = item.MessageID}) |
@Html.ActionLink("Delete", "Delete", New With {.id = item.MessageID})
</td>
</tr>
Next
</table>
을 스캐 폴딩 코드. item.MessageRead 값의 값에 따라 <tr>
의 클래스 이름을 변경하기 만하면됩니다.
tr의 클래스가 "예상 됨"이라고 말하면 </td>
은 "식별자가 필요합니다"라고 말하면 <td>
은 "특성 지정자가 완전한 문이 아니며 다음 명령문에 특성을 적용 할 때 줄을 사용하십시오"라고 말합니다.
다른 사람도 VB Razor 구문에 대한 설명서를 지적 할 수 있으면 좋을 것입니다.