再问:关于calendar控件 如何在calendar里设置有一些日期有链接,有些不可以点击最好能与数据库邦定不知道可不可以实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你研究一下这段代码<html><head> <script language="C#" runat="server"> String [][] holidays; void Page_Load(Object Sender, EventArgs e) { holidays = new String[13][]; for (int n=0; n<13 ;n++) holidays[n] = new String[32]; holidays[1][1] = "元旦"; holidays[1][26] = "澳大利亚国庆节"; holidays[2][2] = "土拨鼠日"; holidays[2][14] = "情人节"; holidays[3][17] = "圣帕特里克节"; holidays[4][1] = "愚人节"; holidays[5][1] = "国际劳动节"; holidays[6][15] = "我的生日"; holidays[7][15] = "我的纪念日"; holidays[8][15] = "我母亲的生日"; holidays[9][24] = "秋分"; holidays[12][26] = "节礼日"; } void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; if (d.IsOtherMonth) { c.Controls.Clear(); } else { try { string Hol = holidays[d.Date.Month][d.Date.Day]; if (Hol != null) c.Controls.Add(new LiteralControl("<br>" + Hol)); else d.IsSelectable=false; } catch (Exception exc) { Response.Write (exc.ToString()); } } } void Date_Selected(object s, EventArgs e) { Label1.Text = "选定日期为:" + Calendar1.SelectedDate.ToShortDateString(); } </script></head><body> <h3><font face="宋体">向日历添加自定义内容</font></h3> <p><p> <form runat=server> <asp:Calendar id=Calendar1 runat="server" ondayrender="Calendar1_DayRender" onselectionchanged="Date_Selected" ShowGridLines="true" Font-Name="Verdana;Arial" Font-Size="9px" Width="500px" VisibleDate="01/01/2000" TitleStyle-BackColor="Gainsboro" TitleStyle-Font-Size="12px" TitleStyle-Font-Bold="true" DayStyle-VerticalAlign="Top" DayStyle-Height="50px" DayStyle-Width="14%" SelectedDate="1/1/0001" SelectedDayStyle-BackColor="Navy" /> <p> <asp:Label id=Label1 runat="server" /> </form></body></html> 你研究一下这段代码<html><head> <script language="C#" runat="server"> String [][] holidays; void Page_Load(Object Sender, EventArgs e) { holidays = new String[13][]; for (int n=0; n<13 ;n++) holidays[n] = new String[32]; holidays[1][1] = "元旦"; holidays[1][26] = "澳大利亚国庆节"; holidays[2][2] = "土拨鼠日"; holidays[2][14] = "情人节"; holidays[3][17] = "圣帕特里克节"; holidays[4][1] = "愚人节"; holidays[5][1] = "国际劳动节"; holidays[6][15] = "我的生日"; holidays[7][15] = "我的纪念日"; holidays[8][15] = "我母亲的生日"; holidays[9][24] = "秋分"; holidays[12][26] = "节礼日"; } void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; if (d.IsOtherMonth) { c.Controls.Clear(); } else { try { string Hol = holidays[d.Date.Month][d.Date.Day]; if (Hol != null) c.Controls.Add(new LiteralControl("<br>" + Hol)); else d.IsSelectable=false; } catch (Exception exc) { Response.Write (exc.ToString()); } } } void Date_Selected(object s, EventArgs e) { Label1.Text = "选定日期为:" + Calendar1.SelectedDate.ToShortDateString(); } </script></head><body> <h3><font face="宋体">向日历添加自定义内容</font></h3> <p><p> <form runat=server> <asp:Calendar id=Calendar1 runat="server" ondayrender="Calendar1_DayRender" onselectionchanged="Date_Selected" ShowGridLines="true" Font-Name="Verdana;Arial" Font-Size="9px" Width="500px" VisibleDate="01/01/2000" TitleStyle-BackColor="Gainsboro" TitleStyle-Font-Size="12px" TitleStyle-Font-Bold="true" DayStyle-VerticalAlign="Top" DayStyle-Height="50px" DayStyle-Width="14%" SelectedDate="1/1/0001" SelectedDayStyle-BackColor="Navy" /> <p> <asp:Label id=Label1 runat="server" /> </form></body></html> 困扰两年的urlrewrite问题 登录代码问题 求逻辑的方法。 索引超出范围。必须为非负值并小于集合大小。 .NET Framework 2.0 SP2出来了吗,安装sqlserver2008 rc0要求,但找不到下载,急啊 推荐一个微博编辑器 GridView中内嵌DropDownList控件 page document form 之间的区别 如何将读入的HTML流转换为TXT文件 分析器错误:查找 </asp:Label> 标记时遇到意外的文件结尾。 DataGrid如何选择一行数据并显示在页面上(急!!)(我愿出高分!!!!) 菜鸟提问:listbox绑定数据显示问题
<head>
<script language="C#" runat="server"> String [][] holidays; void Page_Load(Object Sender, EventArgs e) { holidays = new String[13][]; for (int n=0; n<13 ;n++)
holidays[n] = new String[32]; holidays[1][1] = "元旦";
holidays[1][26] = "澳大利亚国庆节";
holidays[2][2] = "土拨鼠日";
holidays[2][14] = "情人节";
holidays[3][17] = "圣帕特里克节";
holidays[4][1] = "愚人节";
holidays[5][1] = "国际劳动节";
holidays[6][15] = "我的生日";
holidays[7][15] = "我的纪念日";
holidays[8][15] = "我母亲的生日";
holidays[9][24] = "秋分";
holidays[12][26] = "节礼日";
} void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = ((DayRenderEventArgs)e).Day;
TableCell c = ((DayRenderEventArgs)e).Cell; if (d.IsOtherMonth) {
c.Controls.Clear();
}
else {
try {
string Hol = holidays[d.Date.Month][d.Date.Day]; if (Hol != null)
c.Controls.Add(new LiteralControl("<br>" + Hol));
else
d.IsSelectable=false;
}
catch (Exception exc) {
Response.Write (exc.ToString());
}
}
} void Date_Selected(object s, EventArgs e) {
Label1.Text = "选定日期为:" + Calendar1.SelectedDate.ToShortDateString();
} </script></head><body> <h3><font face="宋体">向日历添加自定义内容</font></h3>
<p><p> <form runat=server> <asp:Calendar id=Calendar1 runat="server"
ondayrender="Calendar1_DayRender"
onselectionchanged="Date_Selected"
ShowGridLines="true"
Font-Name="Verdana;Arial"
Font-Size="9px"
Width="500px"
VisibleDate="01/01/2000"
TitleStyle-BackColor="Gainsboro"
TitleStyle-Font-Size="12px"
TitleStyle-Font-Bold="true"
DayStyle-VerticalAlign="Top"
DayStyle-Height="50px"
DayStyle-Width="14%"
SelectedDate="1/1/0001"
SelectedDayStyle-BackColor="Navy"
/> <p>
<asp:Label id=Label1 runat="server" />
</form></body>
</html>
<head>
<script language="C#" runat="server"> String [][] holidays; void Page_Load(Object Sender, EventArgs e) { holidays = new String[13][]; for (int n=0; n<13 ;n++)
holidays[n] = new String[32]; holidays[1][1] = "元旦";
holidays[1][26] = "澳大利亚国庆节";
holidays[2][2] = "土拨鼠日";
holidays[2][14] = "情人节";
holidays[3][17] = "圣帕特里克节";
holidays[4][1] = "愚人节";
holidays[5][1] = "国际劳动节";
holidays[6][15] = "我的生日";
holidays[7][15] = "我的纪念日";
holidays[8][15] = "我母亲的生日";
holidays[9][24] = "秋分";
holidays[12][26] = "节礼日";
} void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = ((DayRenderEventArgs)e).Day;
TableCell c = ((DayRenderEventArgs)e).Cell; if (d.IsOtherMonth) {
c.Controls.Clear();
}
else {
try {
string Hol = holidays[d.Date.Month][d.Date.Day]; if (Hol != null)
c.Controls.Add(new LiteralControl("<br>" + Hol));
else
d.IsSelectable=false;
}
catch (Exception exc) {
Response.Write (exc.ToString());
}
}
} void Date_Selected(object s, EventArgs e) {
Label1.Text = "选定日期为:" + Calendar1.SelectedDate.ToShortDateString();
} </script></head><body> <h3><font face="宋体">向日历添加自定义内容</font></h3>
<p><p> <form runat=server> <asp:Calendar id=Calendar1 runat="server"
ondayrender="Calendar1_DayRender"
onselectionchanged="Date_Selected"
ShowGridLines="true"
Font-Name="Verdana;Arial"
Font-Size="9px"
Width="500px"
VisibleDate="01/01/2000"
TitleStyle-BackColor="Gainsboro"
TitleStyle-Font-Size="12px"
TitleStyle-Font-Bold="true"
DayStyle-VerticalAlign="Top"
DayStyle-Height="50px"
DayStyle-Width="14%"
SelectedDate="1/1/0001"
SelectedDayStyle-BackColor="Navy"
/> <p>
<asp:Label id=Label1 runat="server" />
</form></body>
</html>