Sorting problem in Data grid control

Discussion in 'ASP .Net Web Controls' started by Sundararajan, Apr 12, 2005.

  1. Sundararajan

    Sundararajan Guest

    Dear Folks,

    I am sorting the records in the data grid control. on click of the
    header hyper link the record gets sorted. but if i move to the next page, it
    shows the unsorted second page; how can i get rid of this.

    Thanx in advance.

    Regards,
    --
    S.Sundararajan
     
    Sundararajan, Apr 12, 2005
    #1
    1. Advertising

  2. Sundararajan

    Brock Allen Guest

    You need to "remember" which column was last sorted. Personally I like to
    use ViewState for this sort of thing, so that once you leave the page and
    go to some other page the column data is gone (as it's not needed anymore).
    You can also use Session, but it becomes clumsy, IMO. For ViewState, just
    access it directly on your page (just as you would Session).

    ViewState["SortColumn"] = "SomeColumnName";

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



    > Dear Folks,
    >
    > I am sorting the records in the data grid control. on click of the
    > header hyper link the record gets sorted. but if i move to the next
    > page, it shows the unsorted second page; how can i get rid of this.
    >
    > Thanx in advance.
    >
    > Regards,
    >
     
    Brock Allen, Apr 12, 2005
    #2
    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. Matthew Louden
    Replies:
    0
    Views:
    374
    Matthew Louden
    Nov 18, 2003
  2. Matthew Louden
    Replies:
    1
    Views:
    2,788
    William \(Bill\) Vaughn
    Nov 18, 2003
  3. C Newby
    Replies:
    7
    Views:
    577
    C Newby
    Apr 2, 2004
  4. Girish
    Replies:
    4
    Views:
    681
    Patrick.O.Ige
    Jul 19, 2005
  5. Matthew Louden

    sorting in data grid run-time error: Cannot find table 0.

    Matthew Louden, Nov 18, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    239
    William \(Bill\) Vaughn
    Nov 18, 2003
Loading...

Share This Page