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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top