try this...
protected void timegrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
}
DataTable dtab;
protected void BindEmptyGrid()
{
try
{
dtab = daNewTable();
DateTime todate_ = Convert.ToDateTime("14-06-2013");
DateTime fromdate_ = Convert.ToDateTime("10-06-2013");
string[] weekdates = new string[5];
DataRow d = dtab.NewRow();
for (DateTime date1 = fromdate_; date1 <= todate_; date1 = date1.AddDays(1))
{
DataColumn dc = new DataColumn();
dc.ColumnName = Convert.ToDateTime(date1).ToString("dd-MM-yyyy");
dtab.Columns.Add(dc);
}
dtab.Rows.Add(d);
if (weekdates.Length > 0)
{
timegrid.DataSource = dtab;
timegrid.DataBind();
}
}
catch (Exception ex)
{
throw ex;
}
}
DataTable dtempty;
public DataTable daNewTable()
{
dtempty = new DataTable();
return dtempty;
}