<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Response.Write(Calendar1.SelectedDate.ToShortDateString());
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date == new DateTime(2013, 1, 1))
{
//Response.Write(e.Day.Date.ToShortDateString() + "<br/>");
//e.Cell.Text = "元旦";
HyperLink lbl = new HyperLink();
lbl.Text = "<br/>元旦";
lbl.NavigateUrl = "http://www.google.com";
e.Cell.Controls.Add(lbl);
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged" OnDayRender="Calendar1_DayRender"></asp:Calendar>
</div>
</form>
</body>
</html>
沒有留言:
張貼留言