Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.68 MB, 90 trang )
{
Session["SelectedCss"] = "WroxUnited.css";
}
else
{
Session["SelectedCss"] = Request.Cookies["PreferredCss"].Value;
}
}
}
That's quite a lot of Ifs! Don't worry – we will come to this in just a moment. However, before
you can run the code, you need to include some stylesheets or nothing will be displayed! You
will also need to make some minor adjustments to some of the code on the page, notably to the
Calendar control's DayRender event handler, to make the page look a bit nicer when the
stylesheet is applied.
6. First, change the DayRender event handler as follows (remove the original style settings and
replace them with a single class statement):
public void EventCalendar_DayRender(object sender, DayRenderEventArgs e)
{
if (((Hashtable)Cache["DateList"])[e.Day.Date] != null)
{
e.Cell.CssClass = "selecteddate";
// e.Cell.Style.Add("font-weight", "bold");
// e.Cell.Style.Add("font-size", "larger");
// e.Cell.Style.Add("border", "3 dotted darkred");
// e.Cell.Style.Add("background", "#f0f0f0");
// The following line will exist in your code if you completed the
// exercises at the end of the last chapter
e.Day.IsSelectable = true;
}