Sorry my very poor english开发者_C百科…
I'm migrating web form project to mvc and i have a lot of doubts. One of them is how to put css on mvc controls like textbox for example. How do that in visual basic? i only saw c# implementation and it seems working, but on vb don't:
ex:
<%= Html.TextBox("txtDate", Nothing, New { @class = "csstext" }) %>
<%= Html.TextBox("txtDate", Nothing, New { .@class = "csstext" }) %>
<%= Html.TextBox("txtDate", Nothing, New With { @class = "csstext" }) %>
<%= Html.TextBox("txtDate", Nothing, New With { .@class = "csstext" }) %>
all of the implementation above generate errors on compilation
<%= Html.TextBox("txtDate", Nothing, New With { ._class = "csstext" }) %>
This implementation don't, but my css doesn't work!
And if i put like this: <asp:TextBox ID="txtDate2" runat="server" CssClass="csstext" />
Works!!
I appreciate if you could help me!
Thank you very much
This should work:
<%= Html.TextBox("txtDate", Nothing, New With { .class = "csstext" }) %>
Darin seems to answer your question (though I have little VB.NET knowledge), but I'd really suggest you to look at FluentHtml from MvcContrib, where you can do
<%= this.TextBox("txtDate").Value(Nothing).Attr("class", "csstext") %>
精彩评论