I'm building an ASP.NET MVC application, using VB.NET and I'm trying to apply a css class to a Html.ActionLink
using the code:
<%=Html.ActionLink("Home", "Index", "Home", new {@class = "tab" })%>
But when I run the code I receive the below error:
Compiler Error Message: BC30988: Type or 'With' expected.
I'm new to MVC and really haven't much of a clue what I'm doing so I can't see what's wrong there as I'm using code based of an example elsewhere.
It is:
If VB.net you set an anonymous type using
and, as other point out, your third parameter should be an object (could be an anonymous type, also).
This syntax worked for me in MVC 3 with Razor:
In VB.NET
This will assign css class "link" to the Contact Us.
This will generate following HTML :
In C# it also works with a null as the 4th parameter.
This works for MVC 5
deleted the c#... here is the vb.net