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

Localizing the Grid Headers

If you develop a multilingual application, you might want to show grid headers text as per the current culture settings. This functionality is can be attained with Telerik RadGrid in the same way as with MS GridView (both controls will behave similarly when you switch the culture for the page which holds it).

The first option to localize the header text is dynamically through resource files as shown here. Another possible solution is illustrated below (note that the first example is for auto-generated columns and the second example is for declarative columns):

Example 1

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" DataSourceID="SqlDataSource1" AllowSorting="True"
  runat="server" OnColumnCreated="RadGrid1_ColumnCreated">
  <MasterTableView Width="100%" AutoGenerateColumns="True" />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
   SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource>
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    GridColumn boundColumn = e.Column as GridColumn;
    switch (boundColumn.UniqueName)
        case "ContactName":
            boundColumn.HeaderText = "My customized contact name";
        case "ContactTitle":
            boundColumn.HeaderText = "My customized contact title";
        case "Address":
            boundColumn.HeaderText = "My customized address";
Protected Sub RadGrid1_ColumnCreated(ByVal sender As Object, ByVal e As GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
    Dim boundColumn As GridColumn = CType(e.Column, GridColumn)

    Select Case boundColumn.UniqueName
        Case "ContactName"
            boundColumn.HeaderText = "My customized contact name"
        Case "ContactTitle"
            boundColumn.HeaderText = "My customized contact title"
        Case "Address"
            boundColumn.HeaderText = "My customized address"
    End Select
End Sub

Example 2

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" DataSourceID="SqlDataSource2" AllowSorting="True"
  runat="server" HorizontalAlign="NotSet">
  <MasterTableView Width="100%" AutoGenerateColumns="False" DataSourceID="AccessDataSource2">
      <telerik:GridBoundColumn DataField="ContactName" HeaderText="" UniqueName="ContactName" />
      <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="" UniqueName="ContactTitle" />
      <telerik:GridBoundColumn DataField="Address" HeaderText="" UniqueName="Address" />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
  SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource>
Protected Sub RadGrid2_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid2.ItemCreated
    If TypeOf e.Item Is GridHeaderItem Then
        Dim headerItem As GridHeaderItem = CType(e.Item, GridHeaderItem)
        Dim button As LinkButton = CType(headerItem("ContactName").Controls(0), LinkButton)
        button.Text = "My customized contact name"

        button = CType(headerItem("ContactTitle").Controls(0), LinkButton)
        button.Text = "My customized contact title"

        button = CType(headerItem("Address").Controls(0), LinkButton)
        button.Text = "My customized address"
    End If
End Sub
protected void RadGrid2_ItemCreated(object sender, GridItemEventArgs e)
    if (e.Item is GridHeaderItem)
        GridHeaderItem headerItem = e.Item as GridHeaderItem;

        LinkButton button = headerItem["ContactName"].Controls[0] as LinkButton;
        button.Text = "My customized contact name";

        button = headerItem["ContactTitle"].Controls[0] as LinkButton;
        button.Text = "My customized contact title";

        button = headerItem["Address"].Controls[0] as LinkButton;
        button.Text = "My customized address";
In this article
Not finding the help you need? Improve this article