1,Html. actionlink ("linktext", "actionname ")
First parameter: Text to be displayed, second parameter: View name
example: <%= HTML. actionlink (" jump to about page ", "about "); %> → jump to about page
2,Html. actionlink ("linktext", "actionname", "controlname ")
First parameter: Text to be displayed, second parameter: View name, Third parameter: controller name
example: <%= HTML. actionlink (" jump to another controler medium ", "Index", "home") ;%> → jump to another controler medium
3,Html. actionlink ("linktext", "actionname", routevalues)
First parameter: Text to be displayed, second parameter: View name, Third parameter:URLParameters in
example: <%= HTML. actionlink (" jump to about page ", "about", new {id = "1", name = "X "}) %> → jump to about page
4,Html. actionlink ("linktext", "actionname", routevalues, htmlattributes)
First parameter: Text to be displayed, second parameter: View name, Third parameter:URLParameters in,Fourth parameter: Set tag attributes
For example: <% = Html. actionlink (" Jump About Page "," About ", new {id =" 1 ", name =" X "}, new {Disabled =" disabled ", @ class =" about "}) %> → <A class = "about" Disabled = "disabled" href = "/home/about/1? Name = x "> Jump About Page </A>
note: set class attribute, class Add @, because class is a keyword.
<% = %> both can be replaced with <%: %>
"<%: %>"And"<% = %>"Differences:<%: %>PerformHtmlencodeEncoded to prevent cross-site scripting attacks (I .e:XSSAttack ).
<%: <Div> Display Div <Div >%> → <Div> Display Div <div> While <% = <Div> Display Div <Div >%> → Display Div
<%: %>When using a function, the function must have a return value. Otherwise, an error is returned.
Transferred from:Http://daociyiyou111.blog.163.com/blog/static/1647015122011930113339916/