博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
.net日历控件 Calendar选择多个日期
阅读量:2119 次
发布时间:2019-04-30

本文共 1416 字,大约阅读时间需要 4 分钟。

来源:http://dev.mjxy.cn/a-Calendar-calendar-control-multiple-dates-selection.aspx

稍微修改了一下:

public List
SelectDate { set { ViewState["sd"] = value; } get { if (ViewState["sd"] == null) ViewState["sd"] = new List
(); return (List
)ViewState["sd"]; } } protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { List
selectDate = SelectDate; foreach (var item in SelectDate) { if (e.Day.IsOtherMonth) e.Cell.Controls.Clear(); if (e.Day.Date == item) e.Cell.BackColor = System.Drawing.Color.Red; } } protected void Calendar1_SelectionChanged(object sender, EventArgs e) { List
lst = SelectDate; if (lst.Contains(Calendar1.SelectedDate)) { lst.Remove(Calendar1.SelectedDate); } else { lst.Add(Calendar1.SelectedDate); } } protected void Button1_Click(object sender, EventArgs e) { foreach (var item in SelectDate) { Response.Write(item.ToString() + "
"); } }

转载地址:http://ohzrf.baihongyu.com/

你可能感兴趣的文章
稻草人手记
查看>>
第一次kaggle比赛 回顾篇
查看>>
leetcode 50. Pow(x, n)
查看>>
leetcode 130. Surrounded Regions
查看>>
【托业】【全真题库】TEST2-语法题
查看>>
博客文格式优化
查看>>
【托业】【新托业全真模拟】疑难语法题知识点总结(01~05)
查看>>
【SQL】group by 和order by 的区别。
查看>>
【Python】详解Python多线程Selenium跨浏览器测试
查看>>
Jmeter之参数化
查看>>
Shell 和Python的区别。
查看>>
Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结
查看>>
Loadrunner之https协议录制回放报错如何解决?(九)
查看>>
python中xrange和range的异同
查看>>
列表、元组、集合、字典
查看>>
【Python】easygui小甲鱼
查看>>
【Python】关于Python多线程的一篇文章转载
查看>>
【Pyton】【小甲鱼】文件
查看>>
【Pyton】【小甲鱼】永久存储:腌制一缸美味的泡菜
查看>>
【Pyton】【小甲鱼】异常处理:你不可能总是对的
查看>>