Reputation:
I tried to use the following code snippet in the PreRender event to change the HeaderText but it is not working.
Actually, I just noticed RadGrid1.columns
was empty (with a break point) but my RadGrid has 3 columns:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
foreach (GridColumn col in RadGrid1.Columns)
{
if (col.UniqueName == "idAgir")
col.HeaderText = "Numéro";
if (col.UniqueName == "objet")
col.HeaderText = "Titre du Ticket";
if (col.UniqueName == "dateEtatIncident")
col.HeaderText = "Date dernière intervention";
}
RadGrid1.Rebind();
}
Upvotes: 3
Views: 17457
Reputation: 2254
Your way will work if you'll be using MasterTableView
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
{
if (col.UniqueName == "idAgir")
col.HeaderText = "Numéro";
if (col.UniqueName == "objet")
col.HeaderText = "Titre du Ticket";
if (col.UniqueName == "dateEtatIncident")
col.HeaderText = "Date dernière intervention";
}
RadGrid1.Rebind();
}
Upvotes: 0
Reputation: 22448
var masterTableView = RadGrid1.MasterTableView;
var column = masterTableView.GetColumn("idAgir");
column.HeaderText = "Numéro";
masterTableView.Rebind();
Upvotes: 8