Results 1 to 4 of 4

Thread: [RESOLVED] Problem with HtmlEncode - adding a sort arrow-like html in gridview using a span

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Resolved [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.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    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.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width