views:

23

answers:

1

Hi. i am new on asp.net Dynamic Data. my web application are not in english language. I'm using the Persian language. is it possible to use this language and alignment for it (Right To left) on asp.net Dynamic Data? and persian name for my labels gridview and etc.. Does my question Clear? How to supports persian or arabic language in Dyanamic Data Controls. I need ReName The Caption of Columns to Arabic or persian Language.

+1  A: 

You can add metadata to your data model and use DisplayName attribute for all columns and tables you need to rename.

For example suppose that you have Customer class in your EF or Linq-To-Sql model which contains Name property. All generated classes are defined as partial so you can define your own partial part, mark it with MetadataType and define metadata for class:

[MetadataType(typeof(CustomerMetadata))]
public partial class Customer
{ }

[DisplayName("Table ...")]
public class CustomerMetadata
{
  // Convention: All metadata fields must have same name as fields from original class
  [DisplayName("Column ...")]
  public object Name { get; set }
}

For right to left support I guess you will have to modify generated templates and master page.

Ladislav Mrnka
Thank You.I have to rename my fields manually ?
shaahin
Unfortunately yes.
Ladislav Mrnka
is it possible to supporting other languages on next versions?
shaahin
I'm not sure if this support was added to ASP.NET 4.0 Dynamic data but it was I think it used to be available in project called ASP.NET Dynamic Data Futures.
Ladislav Mrnka
I checked documentation and it should be possible with DisplayAttribute from DataAnnotations namespace.
Ladislav Mrnka