ASP.NET Calendar日历控件
来源:百度知道 编辑:UC知道 时间:2024/05/28 01:59:15
当我设置第一次加载页面显示今年一月时候,为什么我加载的时候还是显示了前一个月这个链接啊
protected void Page_Load ( object sender, EventArgs e )
{
if ( !Page.IsPostBack )
{
if ( DateTime.Now.Month == 1 )
{
this.Calendar1.PrevMonthText = "";
}
}
}
protected void Calendar1_SelectionChanged ( object sender, EventArgs e )
{
Calendar cal = sender as Calendar;
if ( cal.SelectedDate.Year != 1 && cal.SelectedDate.Month == 1 )
{
cal.PrevMonthText = "";
}
else if ( cal.SelectedDate.Year == DateTime.Now.Year + 1 && cal.SelectedDate.Month == 12 )
{
cal.NextMonthText = "";
}
else
{
cal.PrevMonthText = "<<";