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 GridviewDataFormating : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session["StudentList"] = GetStudentList();
Studentlist.DataSource = Session["StudentList"];
Studentlist.DataBind();
grdDataFormatingExm.DataSource = Session["StudentList"];
grdDataFormatingExm.DataBind();
}
static DataTable GetStudentList()
{
//Created virtual data Storage
DataTable table = new DataTable();
table.Columns.Add("JoingDate1", typeof(DateTime));
table.Columns.Add("JoingDate2", typeof(DateTime));
table.Columns.Add("JoingDate3", typeof(DateTime));
table.Columns.Add("JoingDate4", typeof(DateTime));
table.Columns.Add("JoingDate5", typeof(DateTime));
table.Columns.Add("JoingDate6", typeof(DateTime));
table.Columns.Add("JoingDate7", typeof(DateTime));
table.Columns.Add("JoingDate8", typeof(DateTime));
// Now have created some row to fill the the data table
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
table.Rows.Add("11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010", "11/5/2010",
"11/5/2010", "11/5/2010");
return table;
}
}