c# asp.net 日历控件(9)
Calendor控件为用户显示一个日历。它还提供日历选取功能。Calendor控件必须放在Form或者Panel控件内,或者控件的模板内。在添加Calendor控件之后。它一次显示一月的日期。另外,它还显示该月之前的一周和之后的一周。因此,可以显示六周。
FirstDateOfWeek | 设置要在控件中的第一天列显示一周的某天 |
NextMonthText | 设置下一个月导航控件的显示文本 |
PrevMonthText | 设置前一个月导航控件的现实文本 |
SelectDeta |
设置当前日期 |
SelectionMode | 指定用户可以选择单日,一周还是整月的日期选择模式 |
SelectionChanged | 当用户通过单击日期选择器控件选择某一天、一周或整月是发生 |
属性
|
说明
|
实例:通过日历单击某一天可以是实现对用户输入的记录(这是整体思路),当用户再次点击时会出现所提交的东西,不过这个实例不是这样。这个实例只是了解控件的基本作用。
html代码如下:
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
后台代码:
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
public partial class _Default : System.Web.UI.Page
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
}
![](http://shenzhoulong.blog.51cto.com/images/editer/InBlock.gif)
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
this.Calendar1.SelectionChanged += new EventHandler(Calendar1_SelectionChanged);
TextBox1.Visible = true; Button1.Visible = true; Label1.Visible = true;
this.Label1.Text = Calendar1.SelectedDate.ToShortDateString();
Calendar1.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e) {
Label1.Visible = true;
this.Label1.Text = this.TextBox1.Text;
TextBox1.Visible = false; Button1.Visible = false;
效果图:
自己对日历控件的了解还不够,加油