這是我的CShtml代碼 我想檢查一些條件的員工名稱。 如果你可以建議,會很棒。我想檢查屬性值是否爲空或不在MVC中。請建議
@model IEnumerable<ATS.Models.clsManagerApproval>
@{
ViewBag.Title = "ManagerApproval";
Layout = "~/Views/Shared/_Layoutuser.cshtml";
}
<h2>Manager Approval</h2>
<script type="text/javascript">
$(document).ready(function() {
if ($("#EmployeeName").val() == "") {
alert("some sample text abc213");
}
})
</script>
<table style="border: 1px solid white">
<tr>
<th style="width:1px; visibility:collapse;">
@Html.DisplayNameFor(model => model.UAmasterID)
</th>
<th style="width:130px">
@Html.DisplayNameFor(model => model.EmployeeName)
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td style="visibility:collapse;">
@Html.DisplayFor(modelItem => item.UAmasterID)
</td>
<td>
@Html.DisplayFor(modelItem => item.EmployeeName)
</td>
</tr>
}
</table>
我想查看一些條件的員工名稱。 如果你可以建議,會很棒。 感謝
什麼條件?一旦你檢查了你想做什麼?你想要怎麼處理你的腳本(你沒有任何帶'id =「EmployeeName」''的元素) –