zoukankan      html  css  js  c++  java
  • 路由

    路由就是根据你输入的地址格式的不同,会匹配各自的路径

    public class RouteConfig
        {
            public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
                routes.MapRoute(
                    name: "Default1",
                    url: "kfgl/{year}.{month}.{day}",
                    defaults: new { Controller="Home",action="Show", year = "2015", month = "1", day = "1" }
                );
                routes.MapRoute(
                   name: "Default3",
                   url: "find/{low}-{upp}",
                   defaults: new { controller = "Home", action = "FindByPrice" ,low=0,upp=100}
               );
                routes.MapRoute(
                    name: "Default2",
                    url: "{action}-{parent}",
                    defaults: new { Controller = "Home", action = "Show", parent="" }
                );
               
                routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
                
            }
    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
    </head>
    <body>
        <div>
            @*@Html.ActionLink("走第一个路径", "Show", new { year=2015, month=7,day=11})
            @Html.ActionLink("走第二个路径", "ShowParent", new {parent="shandong"})*@
            @using (Html.BeginForm("FindByPrice", "Home"))
            {
                <div>
                最低价格:@Html.TextBox("low")
                最高价格:@Html.TextBox("upp")
                <input type="submit" value="查询" />
               </div>
            }
        </div>
        <div>@Html.Action("FindByPrice")</div>
    </body>
    </html>
    
            
  • 相关阅读:
    jquery获取当前元素的坐标
    JS获取鼠标点击位置坐标
    基于jquery fly插件实现加入购物车抛物线动画效果
    PHP下载远程图片的方法
    IQ测试
    PHP面试题
    Apache服务器错误问题Internal Server Error
    php获取当前浏览器完整地址
    jQuery检测滚动条到达顶部或底部
    scrapy 命令
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4639742.html
Copyright © 2011-2022 走看看