【发布时间】:2011-04-13 12:27:58
【问题描述】:
我目前有一个div 容器用于我的表单中的所有输入字段,类似于:
<div class="ux-single-field ui-widget-content ui-corner-all">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
</div>
我想知道如何使用templated razor delegate(或any other trick)封装它,就像我们使用的那样:
@using (Html.BeginForm()) {
}
我可以像这样简单地包装我的元素:
@using (Html.ContentField()) {
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name)
}
【问题讨论】:
-
请问您要达到什么目的? - 你想让 Html.ContentField() 生成一个 div 吗?
-
@ebb 是的。上面的div。
标签: asp.net asp.net-mvc razor