如何在显示属性、名称字段中添加新行
我正在开发 MVC3 应用程序,并使用数据属性作为屏幕上的显示名称字段。下面是一个代表性示例 -
[Required]
[Display(Name = "Staff Id (format \"9999\")")]
[StringLength(10)]
[UIHint("StaffId")]
public string StaffId { get; set; }
我想要做的是将名称显示在两行中,并在“Id”文本之后换行。所以它会显示为
Staff Id
(format "9999")
Is there a way to do this?
I'm working on an MVC3 application and am using data attributes for the display name fields on the screen. Below is a representative sample -
[Required]
[Display(Name = "Staff Id (format \"9999\")")]
[StringLength(10)]
[UIHint("StaffId")]
public string StaffId { get; set; }
What I would like to do is to have the name display on two lines with line break right after "Id" text. So it would display as
Staff Id
(format "9999")
Is there a way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的
StaffId.cshtml
自定义编辑器模板中:and inside your
StaffId.cshtml
custom editor template:只需添加@Darin-Dimitrov 答案,重要的是使用
而不是典型的 HTML 帮助器,例如
Just adding to @Darin-Dimitrov answer, it is important to use
Instead of typical HTML helpers like