2
我需要將視圖數據(整數)傳遞給另一個控制器。如何使用actionlink將參數傳遞給控制器
這是我試過的;
@Html.ActionLink("Get Location", "Index", "Map", new { [email protected]},null)
我需要將此信息傳遞給「映射」控制器的索引操作方法;
public ActionResult Index(int? i)
{
var Id = from o in db.Objects where o.Id == i select o;
return View(Id);
}
但該參數沒有得到通過...這是傳遞參數的方式??當我把一個斷點我發現int?我是null ..爲什麼?
因爲'「id」!=「i」'。在世界的哪個地方,'我'的價值從何而來? –