protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { switch (DropDownList1.SelectedValue) { case "none": Calendar1.SelectionMode = CalendarSelectionMode.None; break; case "Day": Calendar1.SelectionMode = CalendarSelectionMode.Day;//天方式显示 break; case "WeekDay": Calendar1.SelectionMode = CalendarSelectionMode.DayWeek; break; case "DayWeekMonth": Calendar1.SelectionMode =CalendarSelectionMode.DayWeekMonth; break; }
3.设定值
string y = ye.SelectedValue.ToString(); string m = mo.SelectedValue.ToString(); string d = da.SelectedValue.ToString(); Calendar1.VisibleDate = Convert.ToDateTime(y +"-"+ m +"-"+d)