New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Localization through Resource Files

When localizing different elements of Telerik RadGrid, it may be necessary to use language sources, located in resource files. This process involves two steps:

  1. First, you need to include the necessary settings in a resource file. The sample below shows a simple resource file, containing two value strings:

<resheader name="resmimetype">
 <resheader name="version">
 <resheader name="reader">
   <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 <resheader name="writer">
   <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
 <data name="column1" xml:space="preserve">
 <data name="column2" xml:space="preserve">
  1. Second, after you have a resource file ready, it is necessary to attach to the ItemCreated event, and replace the text in a grid element with the one from the resource. This is shown in the code samples below:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    if (e.Item is GridHeaderItem)
        GridHeaderItem header = (GridHeaderItem)e.Item;

        header["CustomerID"].Text = GetLocalResourceObject("column1").ToString();
        header["CompanyName"].Text = GetLocalResourceObject("column2").ToString();
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
    If TypeOf e.Item Is GridHeaderItem Then
        Dim header As GridHeaderItem = CType(e.Item, GridHeaderItem)

        header("CustomerID").Text = GetLocalResourceObject("column1").ToString()
        header("CompanyName").Text = GetLocalResourceObject("column2").ToString()
    End If
End Sub

If you are using resource files, you can use explicit localization to set the text for the Edit button text, as well as the text for the Cancel, Insert and Update buttons. The code below demonstrates one such approach:

<MasterTableView  CommandItemDisplay="Top"
DataKeyNames="CustomerID" DataSourceID="AccessDataSource1">

    EditColumn-UpdateText='<%$ Resources:Resource, UpdateText %>'
    EditColumn-InsertText='<%$ Resources:Resource, PerformIndertText %>'
    EditColumn-CancelText='<%$ Resources:Resource, CancelText %>'>            

        <telerik:GridEditCommandColumn EditText='<%$ Resources:Resource, EditText %>'>

Additional information on resource files, as well as explicit and implicit resource localization is available on this page:

and in this code library project.

In this article