Inserting data in specified gridview row
<p>I am working with my timesheet program. On the first column of the gridview there are list of each day in a month. How can I simply place the datetime data once I clicked the time in/time Out button?
For example the first row is today's date, after I clicked the time in button the time must be place in the row of today's date.</p>

<p>Here's the code</p>

<pre><code>DataTable dtDates = new DataTable();
    dtDates.Columns.Add("Date"); 
    dtDates.Columns.Add("Time In");
    dtDates.Columns.Add("Time Out");
    if (DateTime.Now.Day &lt; 15)
    {
        DateTime dtStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
        for (int i = 0; i &lt; 15; i++)
        {
            dtDates.Rows.Add(new Object[] { dtStart.ToString("dd-MMM-yyyy") }); // with format 
            dtStart = dtStart.AddDays(1);
            //dtDates.Rows.Add(new Object[] { dtStart }); // without format 
        }
    }
    else
    {
        DateTime dtStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 16);
        for (int i = 0; i &lt; 15; i++)
        {
            dtDates.Rows.Add(new Object[] { dtStart.ToString("dd-MMM-yyyy") }); // with format 
            dtStart = dtStart.AddDays(1);
            //dtDates.Rows.Add(new Object[] { dtStart }); // without format 
        }
    }
    this.GridView1.DataSource = dtDates;
    this.GridView1.DataBind();
</code></pre>
