我正努力做某事3天,但是我做不到。
我有两个压延机。总是会出现一个,而第二个日历2会在用户从上一个下拉列表中选择特定值时向用户隐藏。
现在,当用户未在被隐藏的calender2文本框中插入值时,它将采用初始日期或反日期(1900/01/01)
如果用户未选择要隐藏的日历2的值(我更喜欢这样做),或者至少我想要设置日历的值,我想做的就是将calender2 teaxtbox设置为等于calender1文本框的值。没有选择任何值时,文本框为空
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
DateTime pastday = e.Day.Date;
DateTime date = DateTime.Now;
int year = date.Year;
int month = date.Month;
int day = date.Day;
DateTime today = new DateTime(year, month, day);
if (pastday.CompareTo(today) < 0)
{
e.Cell.BackColor = System.Drawing.Color.Gray;
e.Day.IsSelectable = false;
}
}
protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
{
DateTime pastday = e.Day.Date;
DateTime date = DateTime.Now;
int year = date.Year;
int month = date.Month;
int day = date.Day;
DateTime today = new DateTime(year, month, day);
if (pastday.CompareTo(today) < 0)
{
e.Cell.BackColor = System.Drawing.Color.Gray;
e.Day.IsSelectable = false;
}
}