C
Charly
Situation:
Gridview is bound to an AccessDataSource declaratively.
The 'Auto-generate fields' is on since the DataSource will use a
crosstab query where some columns are known beforehand and others are
not.
The AllowSorting is set declaratively to true.
Now, for the known columns I want to change the ColumnHeader text
depending on some language settings. Using the .Text property works but
the header looses the sort ability (eg. No hyperlink around the header
text). Using the HeaderText property doesn't seem to be doing
anything!!
Code:
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
TableCellCollection cells = e.Row.Cells;
if (e.Row.RowType == DataControlRowType.Header)
{
DataControlFieldHeaderCell c =
(DataControlFieldHeaderCell)cells[5];
BoundField bf = (BoundField)c.ContainingField;
bf.HeaderText = "_PLACE";
}
}
Thanx for any suggestions !!
Charly
Gridview is bound to an AccessDataSource declaratively.
The 'Auto-generate fields' is on since the DataSource will use a
crosstab query where some columns are known beforehand and others are
not.
The AllowSorting is set declaratively to true.
Now, for the known columns I want to change the ColumnHeader text
depending on some language settings. Using the .Text property works but
the header looses the sort ability (eg. No hyperlink around the header
text). Using the HeaderText property doesn't seem to be doing
anything!!
Code:
protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
{
TableCellCollection cells = e.Row.Cells;
if (e.Row.RowType == DataControlRowType.Header)
{
DataControlFieldHeaderCell c =
(DataControlFieldHeaderCell)cells[5];
BoundField bf = (BoundField)c.ContainingField;
bf.HeaderText = "_PLACE";
}
}
Thanx for any suggestions !!
Charly