第1个回答 2009-06-12
我试了一下楼上的,有点问题,改了一下:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (DateTime.Now.Month == 1 || DateTime.Now.Month == 12)
{
if (DateTime.Now.Month == 1)
{
Calendar1.NextMonthText = ">";
Calendar1.PrevMonthText = "";
return;
}
else
{
Calendar1.PrevMonthText = "<";
Calendar1.NextMonthText = "";
return;
}
}
else
{
Calendar1.PrevMonthText = "<";
Calendar1.NextMonthText = ">";
}
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Calendar cal = sender as Calendar;
if (cal.SelectedDate.Month == 1 || cal.SelectedDate.Month == 12)
{
if (cal.SelectedDate.Month == 1)
{
cal.NextMonthText = ">";
cal.PrevMonthText = "";
return;
}
else
{
cal.PrevMonthText = "<";
cal.NextMonthText = "";
return;
}
}
else
{
cal.PrevMonthText = "<";
cal.NextMonthText = ">";
}
}
protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
if (e.NewDate.Month == 1 || e.NewDate.Month == 12)
{
if (e.NewDate.Month == 1)
{
Calendar1.NextMonthText = ">";
Calendar1.PrevMonthText = "";
return;
}
else
{
Calendar1.PrevMonthText = "<";
Calendar1.NextMonthText = "";
return;
}
}
else
{
Calendar1.PrevMonthText = "<";
Calendar1.NextMonthText = ">";
}
}