如何显示jQuery的日期选择器服务器端的日期? [英] how to display server side dates in jquery datepicker?

查看:149
本文介绍了如何显示jQuery的日期选择器服务器端的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的asp.net网络表单一个TextBox1中,显示了服务器端的日期:

我想用jQuery的日期选择器早于迄今在TextBox1中用户不会选择日期

读音字使用以下code,显示在其他TextBox2中jQuery的日历:

 <链接HREF =./主题/晴天/ jquery.ui.all.css的rel =stylesheet属性类型=文/ CSS/>
         <链接HREF =./主题/晴天/ jquery.ui.all.css的rel =stylesheet属性类型=文/ CSS/>
         <脚本SRC =./ JS / jquery.min.js>< / SCRIPT>
         <链接rel =stylesheet属性HREF =./演示/ demos.css>
<脚本SRC =./ JS / jQuery的-ui.min.js>< / SCRIPT>    <脚本类型=文/ JavaScript的>
       $(文件)。就绪(函数(){      $(日期选择器)。日期选择器({          buttonText:选择日期:',
          firstDay:1,
          按钮画面:./demos/datepicker/images/calendar.gif
          buttonImageOnly:真实,
          showOn:无论',
          showAnim:淡入,
          MINDATE:'0',
          DATEFORMAT:'DD-M-YY',
          ONSELECT:函数(){$(本).trigger(的onchange,NULL); }
      });
      });
    < / SCRIPT>


解决方案

  MINDATE:新的Date('<%= textbox1.Text%GT;')

假设你的TextBox1中包含一个有效的日期格式。
你真的需要TextBox1的关系吗?如果你只是想在服务器日期,你可以做:

  MINDATE:新的Date('<%= DateTime.Now.ToString()%GT;')

i have a textbox1 in my asp.net webform which shows the server side date :

i want the user would not select date using jquery datepicker earlier than the date in the textbox1

i m using the following code to show jquery calendar in other textbox2 :

<link href="./themes/sunny/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
         <link href="./themes/sunny/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
         <script src="./js/jquery.min.js"></script>
         <link rel="stylesheet" href="./demos/demos.css">    
<script src="./js/jquery-ui.min.js"></script> 

    <script type="text/javascript">  
       $(document).ready(function() {    

      $(".datepicker").datepicker({    

          buttonText: 'Select date:',    
          firstDay: 1,  
          buttonImage: "./demos/datepicker/images/calendar.gif",  
          buttonImageOnly: true,    
          showOn: 'both',    
          showAnim: 'fadeIn',    
          minDate: '0',
          dateFormat: 'dd-M-yy',    
          onSelect: function() { $(this).trigger("onchange", null); }    
      });    
      });   
    </script> 

解决方案

minDate: new Date('<%= textbox1.Text %>')

Assuming your textbox1 contains a valid date format. Do you actually need textbox1 though? If you just want the server date you can do:

minDate: new Date('<%= DateTime.Now.ToString() %>')

这篇关于如何显示jQuery的日期选择器服务器端的日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆