2009-10-28 20 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") %>