kurozakura
kurozakura

Reputation: 2349

How to add CSS class attribute for Html helper methods in asp.net mvc (VB.NET)?

Name:

<%= Html.TextBox("txtName", "20", new { @class = "hello" }) %>

I want that in VB.NET , is it .cssclass="hello" or is it something else?

Upvotes: 1

Views: 5534

Answers (2)

Travis Laborde
Travis Laborde

Reputation: 1333

You need to use the "With" keyword, and a dot, as follows:

Upvotes: 1

Patricia
Patricia

Reputation: 7802

This works:

<%=Html.TextBox("TextName", "TextBox value", New With {.class = "theClass"})%>

Upvotes: 4

Related Questions