自定义日历控件
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Web.UI;
5using System.Web.UI.WebControls;
6using System.Web.UI.HtmlControls;
7using System.Drawing;
8using System.Collections;
9using System.Collections.Specialized;
10using System.ComponentModel;
11/**//*
12 * * ExpentDate:日期控件
13 * * Writor:Susan
14 * * DateTime:2006/12/18
15 */
16namespace CtrolBox
17{
18 /**//// <summary>
19 /// 日历控件
20 /// </summary>
21 public class ExpentDate: WebControl, INamingContainer,IPostBackDataHandler
22 {
23 控件属性#region 控件属性
24 private TextBox _EditBox;
25 private Calendar _calDate;
26 private ImageButton _btnDate;
27 public int _Columns=15;
28 public TextStyle _Mode;
29 public string _ImageUrl = "Images/Calendar.jpg";
30 public bool _ReadOnly = true;
31 #endregion
32 属性定义#region 属性定义
33 新增属性#region 新增属性
34 /**//// <summary>
35 /// 定义枚举变量
36 /// </summary>
37 public enum TextStyle
38 {
39 point,
40 line,
41 Midline,
42 standard
43 }
44 [Bindable(true),
45 Category("Appearance"),
46 DefaultValue("Point"),
47 Description("指定日期显示样式:point:.;line:/;midline:-;standard:xxxx年xx月xx日")]
48 public TextStyle Mode
49 {
50 get
51 {
52 return _Mode;
53 }
54 set
55 {
56 _Mode = value;
57 }
58 }
59 [Bindable(true),
60 Category("Appearance"),
61 DefaultValue("15"),
62 Description("指定日期显示框的长度")]
63 public int Columns
64 {
65 get
66 {
67 return _Columns;
68 }
69 set
70 {
71 _Columns = value;
72 }
73 }
74 [Bindable(true),
75 Category("Appearance"),
76 DefaultValue("True"),
77 Description("指定日期显示框的可读性")]
78 public bool txtReadOnly {
79 get
80 {
81 return _ReadOnly;
82 }
83 set
84 {
85 _ReadOnly = value;
86 }
87 }
88 [Bindable(true),
89 Category("Appearance"),
90 DefaultValue("Images/Calendar.jpg"),
91 Description("指定日期按钮所用图样")]
92 public virtual string ImageUrl
93 {
94 get
95 {
96 return _ImageUrl;
97 }
98 set
99 {
100 _ImageUrl = value;
101 }
102 }
103 /**//// <summary>
104 /// 开放出来text控件,用于server端取值
105 /// </summary>
106 [Bindable(true),
107 Category("Appearance"),
108 DefaultValue(""),
109 Description("文本框选中值")]
110 public string SelectedText {
111 get
112 {
113 return _EditBox.Text;
114 }
115 set
116 {
117 _EditBox.Text = value;
118 }
119 }
120 private string _OnClientChangedText="";
121 [Bindable(true),
122 Category("Appearance"),
123 DefaultValue(""),
124 Description("文本框Client事件")]
125 public string OnClientChangedText
126 {
127 get
128 {
129
2using System.Collections.Generic;
3using System.Text;
4using System.Web.UI;
5using System.Web.UI.WebControls;
6using System.Web.UI.HtmlControls;
7using System.Drawing;
8using System.Collections;
9using System.Collections.Specialized;
10using System.ComponentModel;
11/**//*
12 * * ExpentDate:日期控件
13 * * Writor:Susan
14 * * DateTime:2006/12/18
15 */
16namespace CtrolBox
17{
18 /**//// <summary>
19 /// 日历控件
20 /// </summary>
21 public class ExpentDate: WebControl, INamingContainer,IPostBackDataHandler
22 {
23 控件属性#region 控件属性
24 private TextBox _EditBox;
25 private Calendar _calDate;
26 private ImageButton _btnDate;
27 public int _Columns=15;
28 public TextStyle _Mode;
29 public string _ImageUrl = "Images/Calendar.jpg";
30 public bool _ReadOnly = true;
31 #endregion
32 属性定义#region 属性定义
33 新增属性#region 新增属性
34 /**//// <summary>
35 /// 定义枚举变量
36 /// </summary>
37 public enum TextStyle
38 {
39 point,
40 line,
41 Midline,
42 standard
43 }
44 [Bindable(true),
45 Category("Appearance"),
46 DefaultValue("Point"),
47 Description("指定日期显示样式:point:.;line:/;midline:-;standard:xxxx年xx月xx日")]
48 public TextStyle Mode
49 {
50 get
51 {
52 return _Mode;
53 }
54 set
55 {
56 _Mode = value;
57 }
58 }
59 [Bindable(true),
60 Category("Appearance"),
61 DefaultValue("15"),
62 Description("指定日期显示框的长度")]
63 public int Columns
64 {
65 get
66 {
67 return _Columns;
68 }
69 set
70 {
71 _Columns = value;
72 }
73 }
74 [Bindable(true),
75 Category("Appearance"),
76 DefaultValue("True"),
77 Description("指定日期显示框的可读性")]
78 public bool txtReadOnly {
79 get
80 {
81 return _ReadOnly;
82 }
83 set
84 {
85 _ReadOnly = value;
86 }
87 }
88 [Bindable(true),
89 Category("Appearance"),
90 DefaultValue("Images/Calendar.jpg"),
91 Description("指定日期按钮所用图样")]
92 public virtual string ImageUrl
93 {
94 get
95 {
96 return _ImageUrl;
97 }
98 set
99 {
100 _ImageUrl = value;
101 }
102 }
103 /**//// <summary>
104 /// 开放出来text控件,用于server端取值
105 /// </summary>
106 [Bindable(true),
107 Category("Appearance"),
108 DefaultValue(""),
109 Description("文本框选中值")]
110 public string SelectedText {
111 get
112 {
113 return _EditBox.Text;
114 }
115 set
116 {
117 _EditBox.Text = value;
118 }
119 }
120 private string _OnClientChangedText="";
121 [Bindable(true),
122 Category("Appearance"),
123 DefaultValue(""),
124 Description("文本框Client事件")]
125 public string OnClientChangedText
126 {
127 get
128 {
129