public class Test : System.Web.UI.Page
...{
protected System.Web.UI.WebControls.Calendar Calendar1;
private System.Threading.Thread t;
private CultureInfo oldCulture;
private void Page_Load(object sender, System.EventArgs e)
...{
// 在此处放置用户代码以初始化页面
}
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
...{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
...{
this.Calendar1.DayRender += new System.Web.UI.WebControls.DayRenderEventHandler(this.Calendar1_DayRender);
this.Calendar1.PreRender += new System.EventHandler(this.Calendar1_PreRender);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
...{
t.CurrentCulture=this.oldCulture;
}
private void Calendar1_PreRender(object sender, System.EventArgs e)
...{
t=System.Threading.Thread.CurrentThread;
oldCulture=t.CurrentCulture;
CultureInfo newci=(CultureInfo)oldCulture.Clone();
newci.DateTimeFormat.DayNames=new string[]...{"日","一","二","三","四","五","六"};
newci.DateTimeFormat.FirstDayOfWeek=DayOfWeek.Sunday;
t.CurrentCulture=newci;
}
}