//DaysinLastMonth gives me the Days in April
//DaysinCurrentMonth gives me the Days in May
public void RunCalender(int startOfCalender, int DaysinLastMonth,int
DaysInCurrentMonth)
{
int value = 0, startOfCalender1 = 0;
for (int i = 0; i < 6; i++)
{
HtmlTableRow tr = new HtmlTableRow();
if (value == 0)
// StartOfCalender is the point where the Calender starts
//from in the month display
startOfCalender1 = startOfCalender;
else
startOfCalender1 = value;
for (int j = 0; j < 7; j++)
{
HtmlTableCell tc = new HtmlTableCell();
tc.BgColor = "#FAAFBE";
// tc.ColSpan = 1;
//tc.Attributes.Add("class", "rowA");
HtmlAnchor a = new HtmlAnchor();
a.HRef = "http://localhost:51955/Calender.aspx";
a.InnerHtml = startOfCalender1.ToString();
startOfCalender1 += 1;
if (startOfCalender1 == DaysinLastMonth + 1)
{
startOfCalender1 = 1;
}
value = startOfCalender1;
// Add the control to the TableCell
tc.Controls.Add(a);
// Add the TableCell to the TableRow
tr.Cells.Add(tc);
}
// Add the TableRow to the Table
tbl.Rows.Add(tr);
}
}
問題は、現在の月、つまり 5 月が本来の 31 日を表示していないことです。この問題を解決する方法を考えることができません