在页面加载时从codebehind获取jquery datepicker的值 [英] getting value to jquery datepicker from codebehind at page load

查看:68
本文介绍了在页面加载时从codebehind获取jquery datepicker的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用jquery datepicker。我的问题是必须在calender.im中禁用backdates,无法从页面加载时的datepicker函数后面的代码中获取值。

< br $> b $ b

i'm using jquery datepicker in my project.my problem is had to disable backdates in the calender.im unable to get the value from the code behind to datepicker function at page load.


protected void daystatus() //placed in pageload
       {
           MySqlConnection con = new MySqlConnection();
           con.ConnectionString = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
           con.Open();
           MySqlCommand cmd = new MySqlCommand("Select mailstatus,daystatus from emp_info where emp_id=" + Session["emp_id"].ToString(), con);
           MySqlDataReader dr = cmd.ExecuteReader();
           while (dr.Read())
           {


               Label2.Text = dr["daystatus"].ToString();
           }
           con.Close();
       }





Label2.text()是我应该在jquery函数中使用的值,它将是存储在var num





Label2.text() is the value that i should use in jquery function which will be stored in var num

 <script type="text/javascript">

    $(function () {
        var num=$('#Label2').val();
        var date = new Date();
        var currentMonth = date.getMonth();
        var currentDate = date.getDate();
        var currentYear = date.getFullYear();
        $('.date').datepicker({
            minDate: new Date(currentYear, currentMonth, currentDate - num),
            maxDate: new Date(currentYear, currentMonth, currentDate),
            dateFormat: 'dd/mm/yy'
        });

    });
</script>







我无法从中获取num值代码behind.help我在codebehind之前加载this.jquery函数导致问题???




I'm unable to get the num value from code behind.help me with this.jquery function loading before codebehind resulting the problem???

推荐答案

function (){
var num =
(function () { var num=


' #Label2')。val();
var date = new 日期();
var currentMonth = date.getMonth();
var currentDate = date.getDate();
var currentYear = date.getFullYear();
('#Label2').val(); var date = new Date(); var currentMonth = date.getMonth(); var currentDate = date.getDate(); var currentYear = date.getFullYear();


' .date ')。datepicker({
minDat e: new 日期(currentYear,currentMonth,currentDate - num),
maxDate: new Date (currentYear,currentMonth,currentDate),
dateFormat:' dd / mm / yy'
});

});
< / script>
('.date').datepicker({ minDate: new Date(currentYear, currentMonth, currentDate - num), maxDate: new Date(currentYear, currentMonth, currentDate), dateFormat: 'dd/mm/yy' }); }); </script>







我无法从中获取num值代码behind.help我在codebehind之前加载this.jquery函数导致问题???




I'm unable to get the num value from code behind.help me with this.jquery function loading before codebehind resulting the problem???


这篇关于在页面加载时从codebehind获取jquery datepicker的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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