Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Oct 10, 2006 05:06 PM|LINK
Thanks for the link I translated the C# code from this site to VB.
After a bit of monkeying around with the translated code I had this Sub.
Sub GridView1_RowCreated(ByVal sender
As Object, ByVal e
If Not (e.Row Is Nothing)
AndAlso e.Row.RowType = DataControlRowType.Header
For Each cell As TableCell
If cell.HasControls Then
Dim button As LinkButton =
If Not (button Is Nothing)
Dim image As Image =
image.ImageUrl = "images/default.gif"
If GridView1.SortExpression = button.CommandArgument
If GridView1.SortDirection = SortDirection.Ascending
image.ImageUrl = "images/uarrow.gif"
image.ImageUrl = "images/darrow.gif"
<asp: code stuff... Blah! />
Added "OnRowCreated" and the Sub "GridView1_RowCreated" to the gridview and bam I have sorting arrows for my gridview.
Also if your gridview ID is named something other that GridView1 you'll need to change the few references to GridView1 in the sub.
I hope this save as much hair as I have pulled out looking for an sorting image solution. :P