Rouchie
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.Ad d(sortImag e) ' <-- not added
e.Row.Cells(2).Controls.Ad d(sortImag e) ' <-- not added
e.Row.Cells(3).Controls.Ad d(sortImag e) ' <-- not added
e.Row.Cells(4).Controls.Ad d(sortImag e) ' <-- added!
End If
End Sub
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.Ad
e.Row.Cells(2).Controls.Ad
e.Row.Cells(3).Controls.Ad
e.Row.Cells(4).Controls.Ad
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.