Back to list
Views:   97.2K
Replies:  1
Archived

Html.ActionLink and class attribute

How do I set the class attribute in Html.ActionLink.  When I include for htmlAttributes: new { class = "border" } I get a compiler error.
This is the full line:

<% = Html.ActionLink("TextLink", "Action", "Controller", new { class = "border" } ) %>
Thanks.
 
Deshaun Hyram, Feb 19, 2010
Reply 1
Hi Deshaun Hyram! But You cann't  use the word "class" because this is reserved keyword . You can try the variant below. For correct use you should be putting symbol "@" before the keyword "class".
<% = Html.ActionLink("TextLink", "Action", "Controller", new { @class = "border" } ) %> 

 
Andrey Lesch, Feb 23, 2010


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.3.0