当前位置: 移动技术网 > IT编程>开发语言>.net > ASP.NET项目开发中日期控件DatePicker如何使用

ASP.NET项目开发中日期控件DatePicker如何使用

2017年12月12日  | 移动技术网IT编程  | 我要评论

扯罩罩,辽阳二手房出售,谌利军举重弃权

前几天做项目的时候要用到日期控件,但是在asp.net中,没有封装日期控件,第一想法就是百度一下喽~,下面给大家分享如何使用这个控件,扩充一下自己的代码库。

首先需要大家下载一个datepicker的javascript的文件,解压文件包,放于所需的项目文件夹下,直接放到js的文件夹下(没有的话直接粘贴进来就可以),然后在要用的界面里面引用这个datepicker的wdatepicker.js文件。

 图一 界面展示

前台代码:

<%@ page language="c#" autoeventwireup="true" codebehind="datepickertest.aspx.cs" inherits="datepickertest2.datepickertest" %>

<!doctype html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  <title>文本框</title>
  <%--引用datepicker的js文件--%>
  <script src="my97datepicker/wdatepicker.js"></script>
</head>
<body>
  <form id="form1" runat="server">
  <div>
   <%--添加文本框--%>
    <asp:textbox id="textbox1" runat="server" onclick="wdatepicker()"></asp:textbox>
    <input id="text1" type="text" class="wdate" onfocus="wdatepicker({lang:'zh-cn'})" />
    <input class="wdate" id="d1" onclick="wdatepicker()" />
  </div>
  </form>
</body>
</html>

效果图:

图二 效果图

datepicker时间控件非常实用,基本在每一个界面上面都会见到这个控件,是很好的操作,希望能给您带来帮助。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网