sort dataview by column index

W

wapsiii

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
 
G

Guest

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top