fletchsod
Programmer
- Dec 16, 2002
- 181
I have a problem. I'm unable to sort the field in DataView. I did Google surfing and found that DataSet cannot be sorted (field) cuz it is tied in to DataSource and that we would have to iterate over DataView instead. So, this is what I did and it still doesn't work.
Code:
oDataView = oDataSet.Tables[0].DefaultView;
oDataView.Sort = "GrossProfit2 DESC";
while (x < xLength) {
Response.Write("<tr>\n");
Response.Write(" <td>" + oDataView.Table.Rows[x]["Year2"].ToString() + "</td>\n");
Response.Write(" <td>" + oDataView.Table.Rows[x]["Make2"].ToString() + "</td>\n");
Response.Write(" <td>" + oDataView.Table.Rows[x]["Model2"].ToString() + "</td>\n");
Response.Write(" <td>" + oDataView.Table.Rows[x]["Style2"].ToString() + "</td>\n");
Response.Write(" <td>" + oDataView.Table.Rows[x]["GrossProfit2"].ToString() + "</td>\n");
Resposne.Write("</tr>\n");
x += 1;
}
[code]
I welcome some helps on fixing the sorting bug to the script I made.