asp.net mvc 之获取地址栏参数

方法有两种

test1的view页面

@html.actionlink("参数传递","test2/1","html")

1在test2 的controller中获取

public ActionResult test2(int id)
{
ViewData["id"] = id;

return View();
}

2在test2的view 中获取

@html.viewcontext.routedata.values["id"]

 上面写的格式不规范应该这样@hml.actionlink("a","index","home",new {id=1,id2=3})

posted @ 2015-09-19 11:08  飞猪.net  阅读(935)  评论(0编辑  收藏  举报