如何在我的視圖中獲取傳遞參數。 我在我的控制器C#mv5通過鏈接傳遞參數然後在視圖中獲取
public ActionResult report()
{
return View();
}
../Map/report/Inventory
的URL已經顯示了通數據,但我怎樣才能得到它通過使用
<td>
<a href="@Url.Action("report", "Map" , new { id = "Inventory"})" target="_blank"> Inventory Reports</a>
</td>
參數jQuery或JavaScript
使用它,我想你已經習慣'公衆的ActionResult報告(字符串ID)'(ID = URL參數)。當控制器返回視圖後,你期望什麼? –
我只需要在JavaScript中獲得通過值。 – gray
使用ViewBag/ViewData&放入這樣的JS:'var id ='@ ViewBag.Id''(或使用viewmodel)。 –