在MVC的aspx视图中添加CSS类 [英] Add CSS class in aspx view of MVC

查看:256
本文介绍了在MVC的aspx视图中添加CSS类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何在MVC的aspx视图中添加CSS类。



请将以下剃刀视图转换为等效的aspx。



 @ Html.TextBoxFor(m => m.Code,new {@class =marb15_I,@ Title =输入代码})

解决方案

您的@ HTML.TextBoxFor是正确的。它正在调用CSS类marb15_I。在_Layout.cshtml中,您应该添加对CSS文档的引用。

两种方法:

或使用razor @ Styles.Render(〜/ CSS / mycss)



将Razor转换为您将获得的Web表单:

< asp:textbox id =txtEntercssclass =marb15_i =ToolTip =enter =code =runat =server =>< / asp:textbox>< / xml>的xmlns:ASP = #未知 >

Hi,

How can i add CSS class in aspx view of MVC.

Please convert the following razor view to aspx equivalent.

@Html.TextBoxFor(m => m.Code, new { @class = "marb15_I",@Title="Enter Code" })

解决方案

Your @HTML.TextBoxFor is correct. It is calling the CSS class marb15_I. In your _Layout.cshtml you should probably add a reference to your CSS document.
Two ways to do it:
or using razor @Styles.Render("~/CSS/mycss")

Converting Razor to web forms you'd get:
<asp:textbox id="txtEnter" cssclass="" marb15_i=" ToolTip=" enter="" code=" runat=" server="></asp:textbox></xml>" xmlns:asp="#unknown">


这篇关于在MVC的aspx视图中添加CSS类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆