@ Html. ActionLink parameter formats: html. actionlink

Source: Internet
Author: User
Tags actionlink

@ Html. ActionLink parameter formats: html. actionlink

Html. actionLink ("linkText", "actionName") the first parameter of this overload is the text to be displayed for the link, and the second parameter is the method of the corresponding controller, the default controller is the controller of the current page. If the controller of the current page is Products, then Html. actionLink ("detail", "Detail") generates <a href = "/Products/Detail"> all </a> second Html. actionLink ("linkText", "actionName", "controlName") this overload has an additional parameter than the first overload. It specifies the Controller name, such as Html. actionLink ("detail", "Detail", "Products") generates <a href = "Products/Detail"> all </a> Html. actionLik ("linkText", "actionName", routeVa Lues) routeValue can pass parameters to actions, such as Html. actionLink ("detail", "Detail", new {id = 1}) generates <a href = "Products/Detail/1"> detail </a>, assume that the current controller is Products. 4. Html. actionLink ("linkText", "actionName", routeValues, htmlAttributes) htmlAttribute can be used to set attributes of <a> tags, such as Html. actionLink ("detail", "Detail", new {id = 1}, new {target = "_ blank "}) <a href = "Products/Detail/1" target = "_ blank"> detail </a> is generated, it is necessary to write new {target = "_ blank", class = "cl AssName "}, an error is reported. Because class is a keyword, it should be written as @ class =" className ". 5. Html. ActionLink ("linkText", "actionName", "controlName", routeValues, htmlAttributes) this overload contains all the parameter types mentioned above

Related Article

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.