When using the MVC helpers (namely the HtmlHelper class in this example) you have to be aware of what you’re typing into the htmlAttributes object (which is an overload of the Action method on that class).
Passing in values via a view is usually as simple as (Im’ using spark here):
${Html.ActionLink("Foo", "Foo", null, new { class = "active" } )}
This works great, however … if you’re using the HtmlHelper in a .cs file you might run into this issue …
return html.ActionLink("Comments", "index", new {area = "Story", controller = "Story", Guid = guid},new { class = cssclass});
THe problem is that last little part:
class = cssclass
The problem is “class” is a reserved word.
How do you get around this issue?
By adding an ‘@’ symbol to the text so it looks like this:
return html.ActionLink("Comments", "index", new {area = "Story", controller = "Story", Guid = guid},new { @class = cssclass});
Now everything is golden. Your code will compile and the output will be “class”, not “@class”.
haha says
replica designer bags I recommend the package
replica designer handbags Of inexpensive package
air max 2012 Comfortable shoes
nike shox turbo Cheap shoes
men puma shoes Unique design Shoes
air max 90 Variety of shoe styles
wholesale puma shoes Pretty shoes
puma shoes sale Cheap comfortable shoes
timberland mens boots Discount a lot of
gucci women shoes Quite well shoes
louis vuitton outlet Very nice
Coach Factory Outlet says
http://buycoachfactoryoutletsz.com