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

Changing Column Header Text when Sorting is Enabled


It is possible to get the GridHeaderItem instance during the PreRender event handler of the grid and change the text of any cell using the headerItem["ColumnName"].Text = "New Value" approach:  
However, when the AllowSorting setting is enabled, changing the Text property of the cell directly breaks the sorting functionality of the column, because it clears the inner controls within the given cell.


You can use one of the following approaches to resolve the issue:

In DataBinding event

protected void RadGrid1_DataBinding(object sender, EventArgs e)
    RadGrid1.MasterTableView.GetColumn("ShipName").HeaderText = "Success";

In PreRender event

protected void RadGrid1_PreRender(object sender, EventArgs e)
    TableCell cell = RadGrid1.MasterTableView.GetHeaderCellByColumnUniqueName("ShipName");
    (cell.Controls[0] as LinkButton).Text = "Success";
In this article