Can not change Headertext with sorting ability in Griview from code behind

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
 
Joined
Feb 19, 2010
Messages
1
Reaction score
0
I encountered the same problem.
May I know if your problem has been fixed? What is the solution? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top