Link to home
Start Free TrialLog in
Avatar of Rouchie
RouchieFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Adding an image to multiple gridview headers

I'm attempting to add an image into the headers of specific columns in my gridview.  The code below doesn't throw an error but only adds the GIF to the final column referenced in the sub.  Can anyone offer any advice as to why that might happen??

Sub addImages(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
      If e.Row.RowType = DataControlRowType.Header Then
            Dim sortImage As New Image()
            sortImage.ImageUrl = "~/images/sorticon.gif"
            e.Row.Cells(1).Controls.Add(sortImage) ' <-- not added
            e.Row.Cells(2).Controls.Add(sortImage) ' <-- not added
            e.Row.Cells(3).Controls.Add(sortImage) ' <-- not added
            e.Row.Cells(4).Controls.Add(sortImage) ' <-- added!
      End If
End Sub
ASKER CERTIFIED SOLUTION
Avatar of lijunguo
lijunguo
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial