Recently encountered a problem for the group of friends to solve the problem
Because I've never really met him before.
I hereby record
The cause is that the group of friends want to use htmlhelper to achieve such an effect
<href= "I am the link" class= "I am the style" data-toggle= "I am a custom attribute "> I am the link name </a>
Our traditional way of writing is this.
@Html. ActionLink (" I am the link name "" i am the link """new {@ class=" I am a style ", data-toggle=" I am a custom attribute "})
You'll find out when you try, and you'll get an error.
What's wrong with the newspaper?
Here are two key solutions
First of all, the "-" is replaced by an underscore.
@Html. ActionLink (" I am the link name "" i am the link """new {@ class=" I am a style ", data_toggle=" I am a custom attribute "})
Well, that will do what we expected.
The second way
@Html. ActionLink (" I am the link name "" i am the link """ "new dictionary<stringobject"class"" I am the style " " "data-toggle " " I am a custom attribute " }})
Well, these are the two ways we do it.
If you have other ways, welcome to add
Laughed at
Some small problems with ActionLink