datatable sort

Discussion in 'ASP .Net' started by reiks, Dec 8, 2003.

  1. reiks

    reiks Guest

    I have a datatable . My requirement is to sort the table
    rows in ascending and descending order basing on the
    columns which I give it.

    I've used the following expression

    ds.Tables[0].DefaultView.Sort="au_fname";

    but it's sorting in ascending order but not in descending.

    How to specify the descending order.

    also let me know how can I include multiple columns in my
    above expression
     
    reiks, Dec 8, 2003
    #1
    1. Advertising

  2. reiks

    Bin Song Guest

    A string containing the column name followed by "ASC"
    (ascending) or "DESC" (descending). Columns are sorted
    asending by default. Multiple columns can be separated by
    commas.
    ds.Tables[0].DefaultView.Sort="au_fname DESC";

    Bin Song, MCP

    >-----Original Message-----
    >I have a datatable . My requirement is to sort the table
    >rows in ascending and descending order basing on the
    >columns which I give it.
    >
    >I've used the following expression
    >
    >ds.Tables[0].DefaultView.Sort="au_fname";
    >
    >but it's sorting in ascending order but not in descending.
    >
    >How to specify the descending order.
    >
    >also let me know how can I include multiple columns in my
    >above expression
    >.
    >
     
    Bin Song, Dec 8, 2003
    #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. J. Babe
    Replies:
    1
    Views:
    8,363
    Kevin Spencer
    Aug 15, 2003
  2. Fredrik Rodin

    Sort a datatable and create a new datatable

    Fredrik Rodin, Feb 16, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    9,062
    paul.mariotti
    Sep 28, 2007
  3. =?Utf-8?B?Qmx1ZWZsb3dlcg==?=

    Casting DataTable to class inherit from DataTable

    =?Utf-8?B?Qmx1ZWZsb3dlcg==?=, Apr 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,004
    =?Utf-8?B?Qmx1ZWZsb3dlcg==?=
    Apr 2, 2004
  4. jg
    Replies:
    1
    Views:
    736
    =?Utf-8?B?U2hhaWxlc2ggSmFubnU=?=
    Aug 17, 2004
  5. Navin
    Replies:
    1
    Views:
    710
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page