Requirement: Where Rows need to show Order wise Ascending or descending in code behind. e.g we are receiving a dataset from database and want to show records in ascending or Descending wise on basis of any column. So we will write the column name in sort order.
if (ds.Tables[0].Rows.Count > 0)
{
DataView dv = new DataView();
dv = ds.Tables[0].DefaultView;
dv.Sort = " AdminMessageId Desc ";
dlAdminMessage.DataSource = dv;
dlAdminMessage.DataBind();
}