Asp.net MVC Tips(routing)

纯属个人记录,即时添加。

1. Register routesroutes. MapRoute(

 "default",                  

"{controller}/{action}/{id}/{name}",                  

new { controller = "Home", action = "Index", id = "", name = "" }               

);  

 

2. Controller:          

public ActionResult Indexa(int id, string name)          

{              

ViewData[   "Message"] = "Welcome to ASP.NET MVC! " + id + " " + name;                

return View("Index");          

}  

 

3. Viewpage: 

@Html.ActionLink( "To home", "indexa","home", new{id="5687",name="hahaha"},"");

posted @ 2011-03-10 19:28  Stone Xie  阅读(251)  评论(0编辑  收藏  举报