http://www.telerik.com/help/aspnet/grid/grdusingcolumns.html
For some reason changing the header text as suggested in the example for me didn't work. I need to change the header text names at runtime due to the headers need to be translated into the viewing clients language. But in fooling around I found a neat trick that did work. It might not be too efficient, but it got what I wanted to get done done.
My Radgrid was bound to a sqldatasource. So I added a new selected event handler on the Page.Init like so-
protected void Page_Init (object sender, EventArgs e)
{
myDataSet.Selected +=
new SqlDataSourceStatusEventHandler (myDataSet_Selected);
}
void myDataSet_Selected (object sender, SqlDataSourceStatusEventArgs e)
{
foreach (GridColumn column in myGridView.Columns)
{
if (column.UniqueName == "some name" )
{
(column as GridBoundColumn ).HeaderText =
"whatever the translated text is";
break;
}
}
}
It works! Hope this helps someone.
No comments:
Post a Comment