zoukankan      html  css  js  c++  java
  • 每天学点MVC 【路由】

    1 Html.BeginForm("Category""Home",new { TestRoute1 "test" },FormMethod.Post,new { id = "FormID" } ) 
    2 
    3 Html.BeginForm("Category""Home",new RouteValueDictionary { {"TestRoute1""test"} },FormMethod.Post,new Dictionary<stringobject> { {"id""FormID
    "} } )

    <% using (Html.BeginForm("Category""Home"new {TestRoute1=HttpContext.Current.Request.QueryString["TestRoute1"] }, FormMethod.Post, new {id = "FormID" })) { %>   

    相当于: 

     <form action="Home/Category?TestRoute1=testid="FormID" method="post">     

        <input type="submit" value="submit" name="subform" /> 

    </form> 

    5

     

    主要注意的是:object routeValues 与object htmlAttributes

        

    routeValues :就是你要传递的参数,eg:http://www.baidu.com/test.php?testid=abcdef 其中 testid=abcdef就是routevalues,或者再MVC中这样表示 new{testid="abcdef"}

        htmlAttributes:就是对应的标签中的属性,在MVC中这样表示:new{@name="testName",@class="TestClass",@id="TestID"} 



  • 相关阅读:
    2017ICPC南宁补题
    H. The Game of Life
    I
    Twice Equation
    (贪心+队列)String
    Marcin and Training Camp
    莫比乌斯函数模版
    HDU-1695 莫比乌斯反演
    Steps to One DP+莫比乌斯反演
    Educational Codeforces Round 62 (Rated for Div. 2)
  • 原文地址:https://www.cnblogs.com/bingzisky/p/2295501.html
Copyright © 2011-2022 走看看