views:

120

answers:

1

Hey guys, what I am trying to do is add a method to my gridview's sorting event to add a class to the column being sorted so the user can know if the data is being sorted ascending or descending and on what column. I am currently trying to do it through a switch statement on the sort expression to determine what column it's coming from but I am unaware of how to set the css class. Any ideas?

A: 

I got it working, turns out I was over thinking it but the task is easily accomplished via:

gridview.HeaderRow.Cells[0].CssClass = "sorted" + sortString;
Jimmy
Be aware that this only works for columns that were not autogenerated (I mean by using AutogenerateColumns = True (true is the default value by the way), because the autogenerated columns will not be added to the column collection.
citronas
yeah I am aware, and it isn't an autogenerated column
Jimmy