Quantcast
Viewing all articles
Browse latest Browse all 7205

GridView - How to localize a column caption

This example illustrates how to localize a column caption by using the DisplayAttribute class from the System.ComponentModel.DataAnnotations namespace. Here is a code snippet that illustrates this:

[C#]
   [Display(Name="Date",ResourceType=typeof(Localization))]   publicDateTimeRegisterDate{get;set;}

Note that localized strings are retrieved from resx files located in the Views\Home\App_LocalResources directory. In addition, we use the DropDownList element to switch between the cultures dynamically.

A preferable approach to localize the predefined elements of our extensions (such as context menus, command buttons, etc.) is to use satellite assemblies: Localizing ASP.NET Controls via Satellite Resource Assemblies.


See Also:
T108044 - Best practices to change the current Culture in ASP.NET MVC Application using ComboBox Extension

Viewing all articles
Browse latest Browse all 7205

Trending Articles