Eric的日期选择下拉列表小控件
利用JS实现日期选择功能,包括润年2月的日数变更, 简单实用! 主要属性: Date
演示地址: http://efplatform.net/demo/webcontrols/datedropdownlist.aspx
下载地下: https://files.cnblogs.com/ericfine/EFPlatform.WebControls.rar
DateDropDownList.aspx:
演示地址: http://efplatform.net/demo/webcontrols/datedropdownlist.aspx
下载地下: https://files.cnblogs.com/ericfine/EFPlatform.WebControls.rar
DateDropDownList.aspx:
<%@ Page Language="C#" %>
<%@ Register Assembly="EFPlatform.WebControls" Namespace="EFPlatform.WebControls" TagPrefix="efp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.DateDropDownList2.Date = DateTime.Today;
this.DateDropDownList3.Date = DateTime.Today.AddYears(-20);
this.DateDropDownList4.Date = DateTime.Parse("1981-12-16");
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = this.DateDropDownList1.Date.ToShortDateString();
this.Label2.Text = this.DateDropDownList2.Date.ToShortDateString();
this.Label3.Text = this.DateDropDownList3.Date.ToShortDateString();
this.Label4.Text = this.DateDropDownList4.Date.ToShortDateString();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>DateDropDownList Demo</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<efp:DateDropDownList ID="DateDropDownList1" runat="server" />
<br />
<efp:DateDropDownList ID="DateDropDownList2" runat="server" />
<br />
<efp:DateDropDownList ID="DateDropDownList3" runat="server" />
<br />
<efp:DateDropDownList ID="DateDropDownList4" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<br />
<asp:Label ID="Label1" runat="server" EnableViewState="False"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" EnableViewState="False"></asp:Label>
<br />
<asp:Label ID="Label3" runat="server" EnableViewState="False"></asp:Label>
<br />
<asp:Label ID="Label4" runat="server" EnableViewState="False"></asp:Label></div>
</form>
</body>
</html>
<%@ Register Assembly="EFPlatform.WebControls" Namespace="EFPlatform.WebControls" TagPrefix="efp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.DateDropDownList2.Date = DateTime.Today;
this.DateDropDownList3.Date = DateTime.Today.AddYears(-20);
this.DateDropDownList4.Date = DateTime.Parse("1981-12-16");
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = this.DateDropDownList1.Date.ToShortDateString();
this.Label2.Text = this.DateDropDownList2.Date.ToShortDateString();
this.Label3.Text = this.DateDropDownList3.Date.ToShortDateString();
this.Label4.Text = this.DateDropDownList4.Date.ToShortDateString();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>DateDropDownList Demo</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<efp:DateDropDownList ID="DateDropDownList1" runat="server" />
<br />
<efp:DateDropDownList ID="DateDropDownList2" runat="server" />
<br />
<efp:DateDropDownList ID="DateDropDownList3" runat="server" />
<br />
<efp:DateDropDownList ID="DateDropDownList4" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<br />
<br />
<asp:Label ID="Label1" runat="server" EnableViewState="False"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" EnableViewState="False"></asp:Label>
<br />
<asp:Label ID="Label3" runat="server" EnableViewState="False"></asp:Label>
<br />
<asp:Label ID="Label4" runat="server" EnableViewState="False"></asp:Label></div>
</form>
</body>
</html>