//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 天。无法思考如何解决这个问题