string strSort = “OperationDate Desc”;

DataView dvTemp = dtEventHistory.DefaultView;
dvTemp.Sort = strSort;

IEnumerable dtRow = dvTemp.ToTable().AsEnumerable().Take(20);

DataTable dtTemp = dtEventHistory.Clone();

foreach (DataRow dr in dtRow)
{
dtTemp.ImportRow(dr);
}

dvHistory = dtTemp.DefaultView;

Advertisements