MVC html. actionlink, mvchtml. actionlink

Source: Internet
Author: User

MVC html. actionlink, mvchtml. actionlink
Html. ActionLink

Description of ActionLink method parameters in the LinkExtensions class:

 

 

In simple words, this is the way you click.

Parameter type description

Text displayed for the link generated by linkText string

Method of the controller corresponding to actionName string

ControllerName string specifies the Controller name

Protocol string specifies the Access protocol

HostName string specifies the access domain name

Fragment string specifies the Access Point

RouteValues RouteValueDictionary parameter passed to the corresponding action

Or object

HtmlAttributes object or IDictionary setting <a> tag attributes

 

Reload 1:

@ Html. ActionLink ("LinkText","ActionName")

Example:

Effect:

 

Heavy Load 2:

@ Html. ActionLink ("LinkText","ActionName", RouteValues)

RouteValues is object:

Example:

Effect:

RouteValues isRouteValueDictionary:

Example:

Effect:

 

Heavy Load 3:

@ Html. ActionLink ("LinkText","ActionName",RouteValues, htmlAttributes)

HtmlAttributes is an object:

Example:

Effect:

HtmlAttributes is IDictionary:

Example:

Effect:

 

Reload 4:

@ Html. ActionLink ("LinkText","ActionName"," ControllerName ")

Example:

 Effect:

 

Overload 5:

@ Html. ActionLink ("LinkText","ActionName","ControllerName"," RouteValues "," htmlAttributes ")

HtmlAttributes andRouteValuesObject:

Example:

Effect:

Note:If it is written as new {target = "_ blank", class = "className"}, an error is returned. Because the class is a keyword, it should be written as this → @ class = "className"

HtmlAttributes isIDictionaryAndRouteValues isRouteValueDictionary:

Example:

Effect:

 

Only partial Overloading is listed above. For more information, see LinkExtensions. cs under namespace System. Web. Mvc. Html.

 

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.