从数据库表搭建的 ASP.Net DynamicData 页面:是否有一种简单的方法来更改它们的名称?

发布于 2024-07-27 18:15:21 字数 261 浏览 2 评论 0原文

ASP.net 脚手架通过在表名称中添加“S”来创建管理页面名称。 因此用户表的编辑页面被命名为Users,依此类推。

有没有一种简单的方法可以更改该名称而不创建自定义页面?

例如,对于表“Business”,我希望 ASP.net DynamicData 创建一个名为“Businesses”的管理链接,该链接出现在首页,而不是我现在得到的非常丑陋的“Businesss”。

当然,我不关心路由 URL 中显示的名称,只希望首页正确显示名称。

ASP.net scaffolding creates administrative page names by adding a 'S' to the name of the table. Thus the editing page for User table is named Users, and so on.

Is there a simple way of changing that name without creating custom pages?

For instance for the table "Business" I'd like ASP.net DynamicData to create an administrative link named "Businesses" appearing at the front page instead of the very ugly "Businesss" I'm getting now.

Of course I don't care about the name that will appear in the routed URL, just want the front page to have the name appearing correctly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南城旧梦 2024-08-03 18:15:21

是的,使用 DisplayName 属性。 它可以用于类和属性。

http://msdn.microsoft.com/en-us/ Library/system.componentmodel.displaynameattribute.aspx

示例:

[MetadataType(typeof(OrderDetailsMetadata))]
public partial class OrderDetails
{
    public const string DisplayName_UnitPrice = "Unit Price";
}

[DisplayName("Order Details")]
public partial class OrderDetailsMetadata
{
    [DisplayName(OrderDetails.DisplayName_UnitPrice)]
    public Decimal UnitPrice { get; set; }
}

Yes, use the DisplayName attribute. It can be used on both Classes and Properties.

http://msdn.microsoft.com/en-us/library/system.componentmodel.displaynameattribute.aspx

Example:

[MetadataType(typeof(OrderDetailsMetadata))]
public partial class OrderDetails
{
    public const string DisplayName_UnitPrice = "Unit Price";
}

[DisplayName("Order Details")]
public partial class OrderDetailsMetadata
{
    [DisplayName(OrderDetails.DisplayName_UnitPrice)]
    public Decimal UnitPrice { get; set; }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文