GridHeaderItem headerItem = RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
int sortIndex = 1;
foreach (GridSortExpression expression in RadGrid1.MasterTableView.SortExpressions)
{
foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
{
if (column is IGridDataColumn)
{
if (expression.FieldName == (column as IGridDataColumn).GetActiveDataField())
{
TableCell cell = headerItem[column.UniqueName];
Literal literal = new Literal();
literal.Text = sortIndex.ToString();
cell.Controls.Add(literal);
}
}
}
sortIndex++;
}
}
You can also use different control for the index and apply custom styles to it.
Best Regards,
Konstantin Dikov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.