I would break the problem down as follows:
1. Use DateTime.DaysInMonth to get the number of days in the selected month. For more info on this, please see:
http://msdn.microsoft.com/en-us/library/system.datetime.daysinmonth.aspx[
^]
2. Based on the number of days, dynamically add your columns. For an example, please see:
how to create columns dynamically in a grid view[
^]
3. The total column may be approached in a couple of different ways; use a formula (challenging, but doable), or for each row simply loop thru the columns and count the cells flagged as present.