how to sort single row from datatable in descending order in asp.net?
for example,
i have one row like
40,45,10,15
after
45,40,15,10
How to sort single row from datatable in descending order ?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Puneet GuptaRank #2,006 · 724 reputationPosted Oct 8, 2013, 4:07 AM EDT
http://www.c-sharpcorner.com/blogs/8973/sorting-data-in-c-sharp-datatable.aspx
Thanks,
Puneet Gupta
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 8, 2013, 5:33 AM EDT
hi,
try following code
DataTable dt = new DataTable();
dt.Columns.Add("mydata");
dt.Rows.Add("40,45,10,15");
foreach (DataRow drow in dt.Rows)
{
drow[0] = string.Join(",", Convert.ToString(drow[0]).Split(new char[] { ',' }).OrderByDescending(f1=>Convert.ToInt32(f1)));
drow.EndEdit();
dt.AcceptChanges();
}
hope this will help you.