当我更改日期选择时,我想更改 HolidayList 上所有事件的字体颜色。如果选定日期有任何事件,label5 也会发生变化,但我想在页面加载时更改所有事件的字体颜色。
private Hashtable HolidayList; /*Will be kept all holidays in it.*/
protected void Page_Load(object sender, EventArgs e)
{
HolidayList = Getholiday();
string date = calendar.TodaysDate.ToShortDateString();
if (HolidayList[date] != null) Label5.Text = (string)HolidayList[date];
else Label5.Text = "";
}
private Hashtable Getholiday()
{
Hashtable holiday = new Hashtable();
holiday["9/5/2013"] = "Mudirin Ad gunu";
holiday["9/7/2013"] = "Dostumun Ad gunu";
holiday["10/28/2013"] = "Tetil";
return holiday;
}
protected void calendar_SelectionChanged(object sender, EventArgs e)
{
string date = calendar.SelectedDate.ToShortDateString();
if (HolidayList[date] != null) Label5.Text = (string)HolidayList[date];
else Label5.Text = "";
}