In ASP. NET learning notes, when will the parameters in HTML helper be Routing Parameters and query strings ?, Helperquery

Source: Internet
Author: User

In ASP. NET learning notes, when will the parameters in HTML helper be Routing Parameters and query strings ?, Helperquery
When will the parameters in HTML helper be Routing Parameters and query strings? @ Html. actionLink ("Edit", "Edit", new {idnumber = item. orderTypeID}) in the preceding html helper, the third parameter is routeValues. If the third parameter does not appear in the route file RouteConfig in App_Start. in cs (url: "{controller}/{action}/{id}/{actionid}"), the third parameter will appear in the url as query string, that is, http: // XXX/ordertypes/Edit? Idnumber = 1. It should be noted that routeValue is not included in the url routing definition, and none will appear in the url as query string. @ Html. actionLink ("Edit", "Edit", new {id = item. orderTypeID}) But if the third parameter appears in the url: "{controller}/{action}/{id}/{actionid}" definition, it will appear in the url as a route parameter, that is, http: // XXX/ordertypes/Edit/1 (the default route is the edit Method in the ordertypes controller, and the parameter id = 1, the routing parameters are written to the url in the preceding two forms and passed to the controller. However, you must ensure that the parameter name of html helper in views must be consistent with the parameter name in the corresponding actionMethod In the controller, in this way, the data in the view can be correctly transmitted to the controller.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.