2009-10-28 18 views
0

對不起我很糟糕的英語...如何將CSS MVC項目(VB!)

我遷移Web表單項目MVC和我有很多疑惑。其中之一是如何把css放在像文本框這樣的mvc控件上。在Visual Basic中如何做到這一點?我只看到了C#實現,似乎工作,但VB並不:

例如:

<%= Html.TextBox("txtDate", Nothing, New { @class = "csstext" }) %> 
<%= Html.TextBox("txtDate", Nothing, New { [email protected] = "csstext" }) %> 
<%= Html.TextBox("txtDate", Nothing, New With { @class = "csstext" }) %> 
<%= Html.TextBox("txtDate", Nothing, New With { [email protected] = "csstext" }) %> 

所有實施上述產生的彙編

<%= Html.TextBox("txtDate", Nothing, New With { ._class = "csstext" }) %> 

此實現不要錯誤噸,但我的CSS不起作用!

如果我把這樣的:<asp:TextBox ID="txtDate2" runat="server" CssClass="csstext" />

的作品!

我很感謝你能幫助我!

非常感謝您

+0

「如果我把這樣的: 的作品!」那裏中間有什麼遺漏嗎? – Lazarus 2009-10-28 12:48:54

回答

0

這應該工作:

<%= Html.TextBox("txtDate", Nothing, New With { .class = "csstext" }) %> 
0

達林似乎回答你的問題(雖然我沒有什麼VB.NET知識),但我真的建議你看一下FluentHtml從MvcContrib,在那裏你可以做

<%= this.TextBox("txtDate").Value(Nothing).Attr("class", "csstext") %>