views:

64

answers:

3

Hi!

Sorry my very poor english…

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

A: 

This should work:

<%= Html.TextBox("txtDate", Nothing, New With { .class = "csstext" }) %>
Darin Dimitrov
A: 

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") %>
queen3
A: 

That's it Darin!

Thanks ;)

Queen3,

"this.Textbox (Me.TextBox on vb) is not a member of 'ASP.views_log_index_aspx'" :(

Juliana Machado