如何设置标识和文字在MVC2 html.label帮手 [英] How to set ID and Text in html.label helper in mvc2
本文介绍了如何设置标识和文字在MVC2 html.label帮手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%:html.label<have to set ID and Text properties here>%>
plz帮助我..
Plz help me out..
推荐答案
的的 Html.Label 方法返回一个HTML 标签
元素和重新由指定的前psented $ P $属性的属性名pression。例如:
The Html.Label method returns an HTML label
element and the property name of the property that is represented by the specified expression. For example:
<%: Html.Label("Text Content", new { id = "labelId" })%>
剃刀语法
@Html.Label("Text Content", new { id = "labelId" })
第二个参数是htmlAttributes,所以,你可以添加属性要作为这个匿名对象的属性任何HTML。例如:
The second parameter is the htmlAttributes, so, you can add any html attribute you want as a property of this anonymous object. For example:
新{n =号元素,名称=名称的元素,大小= 10,@class =CSS-级}
这篇关于如何设置标识和文字在MVC2 html.label帮手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文