Although it is Beta 1, the principle is actually. NET 1.1 is similar, the following example tells how to add UP.GIF and Down.gif in Headertemplate when you are sorting, and is a map of Down.gif (in ascending, reverse order)% @ page language = "c #"%>
Void GridView1_Rowcreated (Object Sender, GridViewRoweventargs E)
{
IF (E.Row! = Null && E.RowType == DatacontrolRowType.Header)
{
Foreach (Tablecell Cell in E.Row.cells)
{
IF (Cell.hasControls ())
{
LinkButton Button = Cell.Controls [0] as linkbutton;
IF (Button! = null)
{
Image image = new image ();
Image.imageurl = "default.gif";
IF (GridView1.Sortexpression == Button.commandargument)
{
IF (GridView1.SortDirection == SortDirection.ascending)
Image.imageurl = "up.gif";
Else
Image.imageURL = "Down..gif";
}
Cell.Controls.Add (Image);
}
}
}
}
}
script>
hEAD>