views:

87

answers:

1

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.

+3  A: 

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; }
}
Aaron Hoffman
Hey, thanks a lot! I was afraid that I would have to create custom pages.
Fabio de Miranda