zoukankan      html  css  js  c++  java
  • MVC Rounting System 学习心得(二)

    1.Generating Outgoing URLs in Views  
    Rules:

      routes.MapRoute("MyRoute", "{controller}/{action}/{id}", 
                    new { controller = "Home", action = "Index",  
                        id = UrlParameter.Optional }); 
            } 

    View:

    1.  <div> 
              @Html.ActionLink("This is an outgoing URL", "CustomVariable") 
          </div> 

      Html:

      <a href="/Home/CustomVariable">This is an outgoing URL</a> 
      
     routes.MapRoute("NewRoute", "App/Do{action}", 
            new { controller = "Home" }); 

    Html:

    <a href="/App/DoCustomVariable">This is an outgoing URL</a>
    

    2.Generating Outgoing URLs in Views  

    It's not a link, just a literal string.

     @Url.Action("Index", "Home", new { id = "MyId" }) 
  • 相关阅读:
    7.Mongodb安全性流程
    6.Mongodb索引
    5.Mongodb聚合
    8-进程管理
    7-安装包管理
    6-文件系统
    5-权限用户组
    27-ATM+购物车程序
    26.本章小结
    名词解释
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/3100813.html
Copyright © 2011-2022 走看看