using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class DataTableandSession : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session["StudentList"] = GetStudentList();
Studentlist.DataSource = Session["StudentList"];
Studentlist.DataBind();
}
static DataTable GetStudentList()
{
//Created virtual data Storage
DataTable table = new DataTable();
table.Columns.Add("StudentName", typeof(string));
table.Columns.Add("Address", typeof(string));
table.Columns.Add("Phone", typeof(string));
table.Columns.Add("JoingDate", typeof(DateTime));
// Now have created some row to fill the the datatable
table.Rows.Add("Samima Nasim", "Dhaka", "01856587548", "11/5/2010");
table.Rows.Add("Ahsanul Kabir", "Chittagong", "01856587548", "12/ 5/2204");
table.Rows.Add("Nirub Ashasan", "Sylhet", "01856587544", "11/10/ 2008");
table.Rows.Add("Zaman Ahmed", "Rajsahi", "01856587878", "11 /15/ 2003");
table.Rows.Add("Habibur Rahman", "Barisal", "01856587548", "11 /5 / 2010");
return table;
}
}