选择javascript的时间选择控件在asp.net开发中是更好的选择,My97DatePicker时间控件当之无愧更是首选。asp.net也自带了Calendar,应用起来还是麻烦了些。这几年js的时间选择控件,一百度一大堆,各式各样的都有。
My97DatePicker,样式多,功能全,可选择时分秒,图示:
应用示例:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="My97DatePickerTest.aspx.cs" Inherits="My97DatePickerTest" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <!--引用一下--> <script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" onfocus="WdatePicker({dateFmt:’yyyy-MM-dd’});"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="获得" OnClick="Button1_Click"></asp:Button> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> <asp:TextBox ID="TextBox2" runat="server" onfocus="WdatePicker({dateFmt:’yyyy-MM-dd HH:mm:ss’});"></asp:TextBox> <asp:Button ID="Button2" runat="server" Text="获得" OnClick="Button2_Click"></asp:Button> <asp:Label ID="Label2" runat="server" Text=""></asp:Label> </div> </form> </body> </html>.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class My97DatePickerTest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = TextBox1.Text; } protected void Button2_Click(object sender, EventArgs e) { Label2.Text = TextBox2.Text; } }
官方网址:http://www.my97.net/
下载:http://www.my97.net/dp/down.asp 或者 百度云盘下载示例
文档:http://www.my97.net/dp/demo/index.htm