Hi micah,
Refer the below sample.
C#
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),
new DataColumn("Name", typeof(string)),
new DataColumn("Country",typeof(string)) });
dt.Rows.Add(1, "Test Name 1", "Country 1");
dt.Rows.Add(2, "Test Name 2", "Country 2");
dt.Rows.Add(3, "Test Name 3", "Country 3");
dt.Rows.Add(4, "Test Name 4", "Country 4");
dt.Rows.Add(5, "Test Name 5", "Country 5");
dt.Rows.Add(6, "Test Name 6", "Country 6");
dt.Rows.Add(7, "Test Name 7", "Country 7");
dt.Rows.Add(8, "Test Name 8", "Country 8");
dt.Rows.Add(9, "Test Name 9", "Country 9");
dt.Rows.Add(10, "Test Name 10", "Country 10");
var result = dt.AsEnumerable().Take(5);
DataTable dt1 = dt.Clone();
foreach (DataRow dr in result)
{
dt1.Rows.Add(dr["Id"], dr["Name"], dr["Country"]);
}
dlTake5.DataSource = dt1;
dlTake5.DataBind();
VB.Net
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(2) {New DataColumn("Id", GetType(Integer)), New DataColumn("Name", GetType(String)), New DataColumn("Country", GetType(String))})
dt.Rows.Add(1, "Test Name 1", "Country 1")
dt.Rows.Add(2, "Test Name 2", "Country 2")
dt.Rows.Add(3, "Test Name 3", "Country 3")
dt.Rows.Add(4, "Test Name 4", "Country 4")
dt.Rows.Add(5, "Test Name 5", "Country 5")
dt.Rows.Add(6, "Test Name 6", "Country 6")
dt.Rows.Add(7, "Test Name 7", "Country 7")
dt.Rows.Add(8, "Test Name 8", "Country 8")
dt.Rows.Add(9, "Test Name 9", "Country 9")
dt.Rows.Add(10, "Test Name 10", "Country 10")
Dim result = dt.AsEnumerable().Take(5)
Dim dt1 As DataTable = dt.Clone()
For Each dr As DataRow In result
dt1.Rows.Add(dr("Id"), dr("Name"), dr("Country"))
Next
dlTake5.DataSource = dt1
dlTake5.DataBind()