I have code below, I need redirect to an other view page.
function patrListClick(PAT_ID) {
window.location.href = '<%: Url.Action("PatrList", "Patr", new { id = "_id_" }) %>'.replace('_id_', PAT_ID);
}
Unfortunately, I got compilation error.
Try this:
function patrListClick(PAT_ID) {
window.location.href = '<%: Url.Action("PatrList", "Patr", new with { .id = "_id_" }) %>'.replace('_id_', PAT_ID);
}
Why are you doing it that way,you can sort it by using Url.Action()
and concatenating query string parameters this way:
function patrListClick(PAT_ID) {
window.location.href = '<%: Url.Action("PatrList", "Patr") %>?id='+PAT_ID;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.