我有以下代码,如果状态为1,我试图禁用视图中的所有链接。但是,当我运行我的代码时,它只是跳过整个部分脚本视图,里面有我的Jquery。我能做什么才能读取我的代码?
@model IEnumerable<RiAct._02.Models.ModelRisk>
@{
List<RiAct._02.Models.ModelRisk> list = new List<RiAct._02.Models.ModelRisk>();
foreach (var m in Model)
{
list.Add(m);
}
int status = 0;
if (list.Count() > 0)
{
RiAct._02.Models.ModelRisk risk = list.First();
status = Convert.ToInt32(risk.ModelProcess.Status);
}
<h1>status is @status</h1>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<script src="@Url.Content("~/Scripts/CustomJquery.js")"></script>
@if (status != 1)
{
<script>
$(document).ready(function () {
function DisableFeatures() {
$("a").prop('disabled', true).css('color', "gray");
}
DisableFeatures();
});
</script>
}
else
{
<script>
$(document).ready(function () {
function EnableFeatures() {
$("a").prop('disabled', false).css('color', "#2fa4e7");
}
EnableFeatures();
});
</script>
}
}