|
-
Mar 13th, 2009, 01:31 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Problem with HtmlEncode - adding a sort arrow-like html in gridview using a span
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.
Thanks a lot for your help.
-
Mar 13th, 2009, 02:40 PM
#2
Re: Problem with HtmlEncode - adding a sort arrow-like html in gridview using a span
What do you get if not the arrow? Do you have an InnerHtml property available to you for the Header? Why HtmlDecode?
Have you considered adding a Literal control that contains the HTML you want?
-
Mar 13th, 2009, 02:54 PM
#3
Thread Starter
Fanatic Member
Re: Problem with HtmlEncode - adding a sort arrow-like html in gridview using a span
ur question made me suspicous and u re right Mendhak, it's working, it s just that arrow was hidden under the original text.
Thanks a lot for the questionning that helped me solve the pb
Thanks a lot for your help.
-
Mar 14th, 2009, 08:48 AM
#4
Re: [RESOLVED] Problem with HtmlEncode - adding a sort arrow-like html in gridview using a span
Are you sure your question has been solved? Did you mark this thread as resolved?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|