分享
 
 
 

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

王朝asp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

前台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" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

<HEAD>

<title>日历控件</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script>

var dropShow=false

var currentID

function dropdown(el){

if(dropShow){

dropFadeOut()

}else{

currentID=el

el.style.visibility="visible"

dropFadeIn()

}

}

function dropFadeIn(){

if(currentID.filters.alpha.opacity<100){

currentID.filters.alpha.opacity+=20

fadeTimer=setTimeout("dropFadeIn()",50)

}else{

dropShow=true

clearTimeout(fadeTimer)

}

document.all.ddl_Text.innerText="";

}

function dropFadeOut(){

if(currentID.filters.alpha.opacity>0){

clearTimeout(fadeTimer)

currentID.filters.alpha.opacity-=20

fadeTimer=setTimeout("dropFadeOut()",50)

}else{

dropShow=false

currentID.style.visibility="hidden"

}

}

function dropdownHide(){

if(dropShow){

dropFadeOut()

dropShow=false

}

}

/*

function hiLight(el)

{

if(dropShow)

{

for(i=0;i<el.parentElement.childNodes.length;i++)

{

el.parentElement.childNodes(i).className="link_record0"

}

el.className="link_record1"

}

}

//function CheckMe(el){

//document.all.ddl_Text.innerText=el.innerText

//}

*/

document.onclick=dropdownHide

</script>

<LINK href="DDLControl.css" type="text/css" rel="stylesheet">

</HEAD>

<body bgColor="#e6e7ed" onload="document.all.Form1.reset()">

<form id="Form1" runat="server">

<table id="Table20">

<tr>

<td>

<div class="link_box" onselectstart="return false" style="WIDTH: 100px">

<div class="link_head">

<table id="Table30" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">

<tr>

<td>

<div class="link_text"><nobr><asp:textbox id="ddl_Text" runat="server" Width="97px" Font-Size="9pt" BorderStyle="Groove">---请选择---</asp:textbox><!--onkeyup="dropdown(value11)" onchange="window.alert('vv')"-->

<!--

<label id="ddl_Text">---请选择---</label>

<input id="ddl_Text" type="text" value="---请选择---" name="ddl_Text">

--></nobr></div>

</td>

<td align="right" width="22"><IMG alt="" src="../../images/other/BIMG.gif" onLoad="this.style.cursor='hand'" onclick="dropdown(value11)"

onmouseup="this.className='link_arrow0'" class="link_arrow0" onmousedown="this.className='link_arrow1'" onmouseout="this.className='link_arrow0'"

onmouseover="" height="20" width="16">

<!--

<div onmouseup="this.className='link_arrow0'" class="link_arrow0" onmousedown="this.className='link_arrow1'"

onmouseout="this.className='link_arrow0'">6</div>

-->

</td>

</tr>

</table>

</div>

<div class="link_value" id="value11" style="WIDTH: 200px; HEIGHT: 200px">

<table id="Table40" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">

<tr>

<td align="center" bgColor="#ffffff" height="30"><asp:Calendar id="Calendar1" runat="server" Font-Size="5pt" Width="198px" BackColor="White" CellPadding="1"

ForeColor="RoyalBlue" BorderWidth="1px" DayNameFormat="FirstLetter" Height="198px" Font-Names="Verdana" BorderColor="#D9D9E6" NextMonthText="下月"

PrevMonthText="上月">

<TodayDayStyle ForeColor="White" BackColor="#99CCCC"></TodayDayStyle>

<SelectorStyle ForeColor="#336666" BackColor="#99CCCC"></SelectorStyle>

<NextPrevStyle Font-Size="8pt" ForeColor="Snow"></NextPrevStyle>

<DayHeaderStyle Height="1px" ForeColor="#336666" BackColor="#99CCCC"></DayHeaderStyle>

<SelectedDayStyle Font-Bold="True" ForeColor="#CCFF99" BackColor="#009999"></SelectedDayStyle>

<TitleStyle Font-Size="7pt" Font-Bold="True" Height="25px" BorderWidth="1px" ForeColor="White"

BorderStyle="Solid" BorderColor="#D9D9E6" BackColor="#6699CC"></TitleStyle>

<WeekendDayStyle BackColor="#CCCCFF"></WeekendDayStyle>

<OtherMonthDayStyle ForeColor="#999999"></OtherMonthDayStyle>

</asp:Calendar></td>

</tr>

</table>

</div>

</div>

</td>

<td><asp:imagebutton id="ImageButton1" runat="server" ImageUrl="~/images/loginImg/login_ok.gif"></asp:imagebutton></td>

</tr>

</table>

<P>&nbsp;</P>

<P><FONT face="宋体"></FONT>&nbsp;</P>

<P><FONT face="宋体"></FONT>&nbsp;</P>

<P><FONT face="宋体"></FONT>&nbsp;</P>

<P><FONT face="宋体"></FONT>&nbsp;</P>

<P><FONT face="宋体"></FONT>&nbsp;</P>

<P>&nbsp;</P>

</form>

</body>

</HTML>

后台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

{

/// <summary>

/// demoCalendar 的摘要说明。

/// </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);

}

/// <summary>

/// 设计器支持所需的方法 - 不要使用代码编辑器修改

/// 此方法的内容。

/// </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);

}

}

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有