[原创]asp.net下的日历控件源代码

**前台aspx文件
** ``` @ Register TagPrefix="componentart" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI"

@ Page language="c#" Codebehind="demoCalendar.aspx.cs" AutoEventWireup="false" Inherits="orderMRP.demo.Calendar.demoCalendar"

1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
日历控件

 

 

 

 

 

 

 

``` **后台cs文件 ** 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 NickLee.Web.UI;

namespace orderMRP.demo.Calendar
{
///

1<summary>   
2/// demoCalendar 的摘要说明。   
3/// </summary>

public class demoCalendar : System.Web.UI.Page
{
private NickLee.Web.UI.encryption en1=new encryption();
private webDataFill Fill=new webDataFill();

protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.TextBox ddl_Text;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Calendar Calendar1;

private void Page_Load(object sender, System.EventArgs e)
{
Fill.ConString=System.Configuration.ConfigurationSettings.AppSettings["SqlConnectionString"];

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

///

1<summary>   
2/// 设计器支持所需的方法 - 不要使用代码编辑器修改   
3/// 此方法的内容。   
4/// </summary>

private void InitializeComponent()
{
this.ddl_Text.TextChanged += new System.EventHandler(this.ddl_Text_TextChanged);
this.Calendar1.VisibleMonthChanged += new System.Web.UI.WebControls.MonthChangedEventHandler(this.Calendar1_VisibleMonthChanged);
this.Calendar1.SelectionChanged += new System.EventHandler(this.Calendar1_SelectionChanged);
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if(ddl_Text.Text!="")
{
webJSUtil.Alert(this,ddl_Text.Text);
this.ddl_Text.Text="---请选择---";
// webJSUtil.ExecuteClientScriptOnWindowLoad(this,"dropdown(value11)");
}
else
{
webJSUtil.Alert(this,"请选择或输入!");
}
}

private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
ddl_Text.Text=Calendar1.SelectedDate.ToShortDateString();
}

private void Calendar1_VisibleMonthChanged(object sender, System.Web.UI.WebControls.MonthChangedEventArgs e)
{
webJSUtil.ExecuteClientScriptOnWindowLoad(this,"dropdown(value11)");
}

private void ddl_Text_TextChanged(object sender, System.EventArgs e)
{
// webJSUtil.Alert(this,this.ddl_Text.Text);
}
}
}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus