4
onSelectRow: function(id) {
   document.location.href = '@Url.Action("EditEncounter", "EditEncounter", new { encounterId = "'<%:id%>'", popId = TempData["POPULATIONID"] })'
                            //new { encounterId = temp.EncounterId, popId = (int)TempData["POPULATIONID"] }
}

如何在 sam hill 中将该 id 变量放入我的 Url.Action 方法中?

这就是我调试时正在查看的内容

document.location.href = '/EditEncounter/EditEncounter?encounterId=%40id&amp;popId=2'
4

1 回答 1

4
var dummyURL ='@Url.Action("EditEncounter", "EditEncounter", new { encounterId = -2, popId = TempData["POPULATIONID"] })';
                            var path =dummyURL.replace("-2", id);
                            debugger;
                            document.location.href = path;

这似乎有效。

于 2012-07-12T23:58:45.757 回答