Displaying current sort indication in the header of a column

Discussion in 'ASP .Net Datagrid Control' started by Eric Caron, May 24, 2005.

  1. Eric Caron

    Eric Caron Guest

    Hello all,

    Using the .NET framework 1.1, is there a way to do this without too much
    coding? I've the got the sorting of my custom columns working both ways (if
    I click on the same column, it reverses the sort direction), but I would
    like to have an indication of the current sort direction by displaying an
    upward or downward pointing arrow. I had it working halfway, but I have no
    way of reverting to the original column name if I just concatenate the
    header name with a graphic.

    Is the best way to save the column header captions on the first page load or
    is there a simpler way?

    Eric
    Eric Caron, May 24, 2005
    #1
    1. Advertising

  2. Eric Caron

    Brock Allen Guest

    You could do it another way, such as adding a Image control into the header
    cell that shows the image. Then if the column isn't the one being sorted
    you don't add the Image control (or remove the control) from the header cell.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hello all,
    >
    > Using the .NET framework 1.1, is there a way to do this without too
    > much coding? I've the got the sorting of my custom columns working
    > both ways (if I click on the same column, it reverses the sort
    > direction), but I would like to have an indication of the current sort
    > direction by displaying an upward or downward pointing arrow. I had
    > it working halfway, but I have no way of reverting to the original
    > column name if I just concatenate the header name with a graphic.
    >
    > Is the best way to save the column header captions on the first page
    > load or is there a simpler way?
    >
    > Eric
    >
    Brock Allen, May 25, 2005
    #2
    1. Advertising

  3. Eric Caron

    Eric Caron Guest

    Thank Brock,

    I found a sample that describes a similar technique, where you add a label
    control to the cell with a character from the webdings font that represents
    an upward or downward arrow (characters 5 and 6 respectively). It seems
    that if I add the control in the ItemCreated event, the control is not
    preserved between postback, so the header text returns to its default state.
    This behaviour is kind of strange to me, but I'm glad it works. =)

    Eric

    "Brock Allen" <> wrote in message
    news:...
    > You could do it another way, such as adding a Image control into the

    header
    > cell that shows the image. Then if the column isn't the one being sorted
    > you don't add the Image control (or remove the control) from the header

    cell.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    > > Hello all,
    > >
    > > Using the .NET framework 1.1, is there a way to do this without too
    > > much coding? I've the got the sorting of my custom columns working
    > > both ways (if I click on the same column, it reverses the sort
    > > direction), but I would like to have an indication of the current sort
    > > direction by displaying an upward or downward pointing arrow. I had
    > > it working halfway, but I have no way of reverting to the original
    > > column name if I just concatenate the header name with a graphic.
    > >
    > > Is the best way to save the column header captions on the first page
    > > load or is there a simpler way?
    > >
    > > Eric
    > >

    >
    >
    >
    Eric Caron, May 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. King Tut

    Progress indication between pages

    King Tut, Aug 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    385
    King Tut
    Aug 29, 2003
  2. humbleaptience
    Replies:
    0
    Views:
    5,478
    humbleaptience
    Feb 22, 2006
  3. hansiman

    Image in header column (not replacing column header text)

    hansiman, Feb 5, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    293
    hansiman
    Feb 7, 2004
  4. Teej
    Replies:
    2
    Views:
    294
  5. Navin
    Replies:
    1
    Views:
    671
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page