Here we are assuming that DataTable dt are having 20 records and from that dt we want to retrieve only first 10 records. The below code snippet will work in this case
private DataTable GethreeRows(DataTable dt)
{
DataTable newdt = dt.Clone();
for(int i=0;i<10;i++)
{
DataRow row = dt.Rows[i];
newdt .Rows.Add(row);
}
return newdt ;
}
Hope it will help you guys.
Thanks