sort dataview by column index

Discussion in 'ASP .Net' started by wapsiii, Mar 12, 2006.

  1. wapsiii

    wapsiii Guest

    is it possible to sort a dataview by a column index?

    Instead of this:
    dv.Sort = "Id";

    I'd like to do this:
    dv.Sort = 0; // where 0 is column index

    /M
     
    wapsiii, Mar 12, 2006
    #1
    1. Advertising

  2. Hi wapsiii,

    Dataview sort Expression is similar to sql query sort (without ORDER BY). It
    takes column name (or names). If you really want to use column index, I
    suggest you use following way:

    dv.Sort = dv.Table.Columns[col_index].ColumnName;


    HTH

    Elton Wang

    "wapsiii" wrote:

    > is it possible to sort a dataview by a column index?
    >
    > Instead of this:
    > dv.Sort = "Id";
    >
    > I'd like to do this:
    > dv.Sort = 0; // where 0 is column index
    >
    > /M
    >
     
    =?Utf-8?B?RWx0b24gVw==?=, Mar 12, 2006
    #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. Nathan Baulch
    Replies:
    0
    Views:
    1,930
    Nathan Baulch
    Jun 26, 2003
  2. CodeMonkey
    Replies:
    1
    Views:
    733
    joyal jhaveri
    Feb 4, 2011
  3. Navin
    Replies:
    1
    Views:
    710
    Ken Schaefer
    Sep 9, 2003
  4. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    315
    Tomasz Chmielewski
    Mar 4, 2008
  5. Rick
    Replies:
    0
    Views:
    155
Loading...

Share This Page