【发布时间】:2019-12-11 15:33:25
【问题描述】:
我知道我这样做是不好的做法,但我仍然想了解为什么这不起作用。
我有 3 个onclick 用于 Javascript 中不同网格的方法:
$('body').on('click', '#clinician-appointments>tbody>tr>td:not(:last-child):not(:first-child)', function () {
var id = $(this).closest("tr").children("td.grid__col--id").find("[name=patient-link]").text().trim();
@{Session["Clinician"] = "opa"};
location.href = "@Url.Action("Summary", "Patient")" + "/" + id;
});
$('body').on('click', '#clinician-current-admissions>tbody>tr>td:not(:last-child):not(:first-child)', function () {
var id = $(this).closest("tr").children("td.grid__col--id").find("[name=patient-link]").text().trim();
location.href = "@Url.Action("Summary", "Patient")" + "/" + id;
@{Session["Clinician"] = "ca"};
});
$('body').on('click', '#clinician-diagnostics>tbody>tr>td:not(:last-child):not(:first-child)', function () {
var id = $(this).closest("tr").children("td.grid__col--id").find("[name=patient-link]").text().trim();
location.href = "@Url.Action("Summary", "Patient")" + "/" + id;
@{Session["Clinician"] = "diag"};
});
但是,当我在 C# 中调用会话时,它总是“诊断”,即最后一个分配的。
因此,由于他们参加不同的赛事,其他赛事将被错过。
【问题讨论】:
标签: javascript c# jquery razor