加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-2 – Asp.net MVC标签

发布时间:2020-12-15 22:25:47 所属栏目:asp.Net 来源:网络整理
导读:我有以下内容 label for="Forename"Forename/label %= Html.TextBoxFor(m = m.Customer.Name.Forename) % 这个问题是它被渲染为 label for="Forename"Forename/labelinput type="text" value="" name="Customer.Name.Forename" id="Customer_Name_Forename"
我有以下内容
<label for="Forename">Forename</label>
 <%= Html.TextBoxFor(m => m.Customer.Name.Forename) %>

这个问题是它被渲染为

<label for="Forename">Forename</label>
<input type="text" value="" name="Customer.Name.Forename" id="Customer_Name_Forename">

不是我想要的.

我想要一个扩展来正确渲染标签(即使用具有输入id值的for =“”属性),在我编写自己的扩展之前,MVC 2中有什么东西可以做到这一点吗?

解决方法

<%= Html.LabelFor(m => m.Customer.Name.Forename) %>
<%= Html.TextBoxFor(m => m.Customer.Name.Forename) %>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读