WebForm1.aspx.cs
资源名称:Visual.rar [点击查看]
上传用户:yiyuerguo
上传日期:2014-09-27
资源大小:3781k
文件大小:3k
源码类别:
C#编程
开发平台:
Others
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using System.Globalization;
- namespace Cal
- {
- /// <summary>
- /// WebForm1 的摘要说明。
- /// </summary>
- public class WebForm1 : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.Label Label1;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.Label Label4;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Web.UI.WebControls.Label Label6;
- protected System.Web.UI.WebControls.Label Label7;
- protected System.Web.UI.WebControls.Label Label8;
- protected System.Web.UI.WebControls.Label Label9;
- protected System.Web.UI.WebControls.Label Label10;
- protected System.Web.UI.WebControls.Label Label11;
- protected System.Web.UI.WebControls.Label Label12;
- protected System.Web.UI.WebControls.Label Label13;
- protected System.Web.UI.WebControls.Calendar Calendar1;
- private void Page_Load(object sender, System.EventArgs e)
- {
- /*
- DateTimeFormatInfo dtf = new DateTimeFormatInfo();
- dtf.DayNames = new string[]{"日", "一", "二", "三", "四", "五", "六"};
- CultureInfo ci = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
- ci.DateTimeFormat = dtf;
- System.Threading.Thread.CurrentThread.CurrentCulture = ci;
- */
- // 取得当前线程中的地区设定(原对象为只读)
- CultureInfo ciNew = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
- // 改变日历的设定
- ciNew.DateTimeFormat.AbbreviatedDayNames = new string[]{"日","一","二","三","四","五","六"};
- // 重新对地区设定赋值
- System.Threading.Thread.CurrentThread.CurrentCulture = ciNew;
- // 在此处放置用户代码以初始化页面
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.Calendar1.SelectionChanged += new System.EventHandler(this.Calendar1_SelectionChanged);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
- {
- Label8.Text = Calendar1.SelectedDate.Date.ToString();
- Label9.Text = Calendar1.SelectedDate.Month.ToString();
- Label10.Text = Calendar1.SelectedDate.Day.ToString();
- Label11.Text = Calendar1.SelectedDate.Year.ToString();
- Label12.Text = Calendar1.SelectedDate.DayOfWeek.ToString();
- Label13.Text = Calendar1.SelectedDate.DayOfYear.ToString();
- }
- }
- }