asp.net-mvc-3 – 在MVC3中使用Html.LabelFor的表单标签中的锚标记
发布时间:2020-09-06 03:12:05 所属栏目:asp.Net 来源:互联网
导读:我想完成类似的事情 label for=AgreedToThermsI agree to the a href=therms-and-conditionsTherms and conditions/a/label 这是否允许根据HTML标准? 在视图中使用标准Html帮助器 @Html.LabelFor(model = model.AgreedToTherms) 我试
|
我想完成类似的事情 <label for="AgreedToTherms"> I agree to the <a href="therms-and-conditions">Therms and conditions</a> </label> 这是否允许根据HTML标准? @Html.LabelFor(model => model.AgreedToTherms) 我试图在labeltext中添加html,但是这个文本得到了html编码 解决方法你可以这样做:@MvcHtmlString.Create(HttpUtility.HtmlDecode(
Html.LabelFor(m=>m.AgreedToTherms).ToString()))
(要么) @Html.Raw(@HttpUtility.HtmlDecode(
Html.LabelFor(m=>m.AgreedToTherms).ToString())) (编辑:南阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Asp.NetCore1.1版本去掉project.json后如何打包生成跨平台包
- asp.net fileupload控件上传文件与多文件上传
- asp.net-mvc-5 – 我需要在MVC Razor中编码属性值吗?
- asp.net – 渗透测试人员说.ASPXAUTH cookie是不安全的并且
- asp.net-mvc – 使用ASP.NET MVC进行项目组织的最佳实践
- asp.net-mvc – 如何设置AntiForgeryToken cookie路径
- asp.net – 为什么Global.asax事件在我的ASP.NET网站没有触
- 优化 – 字典/客户端VS应用程序变量
- asp.net – 在为app_offline.htm提供特定URL时,将http状态5
- asp.net-mvc – ASP.NET MVC 3 Beta 1 Block访问Razor视图
