Hi,
I use this code to add a simulated arrow-like image when the user tries to sort a gridview rows by clicking on the header of a HyperLinkField column:
Const SORT_ASC As String = " <span style='font-family: Webdings;font-size:8px '> 5</span>"
Const SORT_DESC As String = " <span style='font-family: Webdings;font-size:8px '> 6</span>"
As you might already know, adding that html is supposed to give an arrow-like look when rendering. Here is the rest of the code:
Protected Sub CoursesGridView_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles CoursesGridView.Sorted
' Including arrow showing the sort direction
If grid.SortDirection = SortDirection.Ascending Then
grid.Columns(0).HeaderText &= HttpUtility.HtmlDecode(SORT_ASC)
Else
grid.Columns(0).HeaderText &= HttpUtility.HtmlDecode(SORT_DESC)
End If
End Sub
Every thing works well if I am dealing with a ButtonField column in my gridview, but I am dealing with a HyperLinkField, then I don t get the arrow rendered as it should.
Please notice that when I have a BoundField column I add htmlEncode = false in the field aspx markup . But when I have a HyperLinkField, we can't really add HtmlEncode in the field aspx markup , right?
Thanks for ur help.




Reply With Quote