Reputation: 35
I tried something like this:
double[] listArray = new double[] { Convert.ToDouble(GridView1.Rows[k].Cells[1].Text) };
than pass this to an array:
var num = new List<double>();
num.AddRange(listArray);
num.Sort();
I only want to pass gridView column values to a List<> than rank it.
Upvotes: 0
Views: 105
Reputation: 1
you can declare list then you can simply run a for loop on all rows and just add this particular column value to the list. an then apply the Sort method.
something like this.
List<int> ids = new List<int>(YouRowCount);
foreach (var row in youRows)
ids.Add((int)row["id"]); //or access by column index
Upvotes: 1