无法理解问题出在哪里......我的溃败值是:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
我尝试传递参数 id :
@Html.ActionLink(app.Name, "SingleAppEdit", "Admin", new { id = app.Id }, null)
对于我在控制器“管理员”中的操作:
public ActionResult SingleAppEdit(string appId)
{
var positions = new List<SelectListItem>
{
new SelectListItem() {Text = "Top", Value = "Top"},
new SelectListItem() {Text = "Bottom", Value = "Bottom"},
new SelectListItem() {Text = "None", Value = "None"}
};
ViewData["PositionsList"] = new SelectList(positions, "Value", "Text");
var app = Apps.FirstOrDefault(a => a.Id == Convert.ToInt32(appId));
return View(app);
}
我在控制器中得到空值。有人可以帮忙吗?