1 Html. beginform ( " Category " , " Home " , New { Testroute1 = " Test " }, Forpolichod. Post, New {Id = "Formid " })
2
3 Html. beginform ( " Category " , " Home " , New Routevaluedictionary {{ " Testroute1 " , " Test " }}, Forpolichod. Post, New Dictionary < String , Object > {{ " ID " , " Formid
"}})
4 <%Using (Html. beginform ( " Category " , " Home " , New { Testroute1 = Httpcontext. Current. Request. querystring [ " Testroute1 " ] }, Forpolichod. Post, New {Id = " Formid " }) {%>
Equivalent:
" Home/category? testroute1 = test " id = " formid " method = " post "
<Input type ="Submit"Value ="Submit"Name ="Subform"/>
</Form>
5
Note: Object routevalues and object htmlattributes
Routevalues: The parameter you want to pass, eg: http://www.baidu.com/test.php? Testid = abcdef where testid = abcdef is routevalues, or in MVC, it indicates new {testid = "abcdef "}
Htmlattributes: the attribute in the corresponding tag. In MVC, it indicates: New {@ name = "testname", @ class = "testclass", @ ID = "testid "}