如何使用jquery从C#获取日期时间值 [英] How to get a datetime value from C# using jquery

查看:109
本文介绍了如何使用jquery从C#获取日期时间值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这行Jquery代码确实存在真正价值的问题





I do have a problem of the real value with this line of Jquery code

$("#<%=lblCheckinViewoData.ClientID%>").datepicker({ dateFormat: "yy/mm/dd" }).datepicker("setDate", (result.reservationInfo[0].Checkin));





实际上这



Actually this

result.reservationInfo[0].Checkin

从我在c#中的pagemethod函数给出2016/03/10,其值来自我的数据库。

但在Jquery中它将当前日期时间2016/04/24传递给lblCheckinViewoData。

我不知道是不是因为这个setDate参数。



请帮我从我的数据库中获取真正的价值导致价值sql server是2016/03/10



我尝试过:



gives 2016/03/10, from my pagemethod function in c# which the value is coming from my database.
But in Jquery it is passing a current datetime which is 2016/04/24 to a lblCheckinViewoData.
I dont know if it is because of this setDate parameter.

Please help me getting the real value from my database cause the value in sql server is 2016/03/10

What I have tried:

PageMethods.GetReservationById(aData[index], function (response) {
                    var result = eval("(" + response + ")");
                      if ($('#<%=lblCheckinViewoData.ClientID%>').length > 0) {
                        
                        $("#<%=lblCheckinViewoData.ClientID%>").datepicker({ dateFormat: "yy/mm/dd" }).datepicker("setDate", (result.reservationInfo[0].Checkin));
                        $("#<%=lblCheckoutViewoData.ClientID%>").datepicker({ dateFormat: "yy/mm/dd" }).datepicker("setDate", (result.reservationInfo[0].Checkout));
                      
                        }
                });

推荐答案

(#<%= lblCheckinViewoData.ClientID %>)。datepicker({dateFormat:yy / mm / dd})。datepicker(setDate,(result.reservationInfo [0] .Checkin));
("#<%=lblCheckinViewoData.ClientID%>").datepicker({ dateFormat: "yy/mm/dd" }).datepicker("setDate", (result.reservationInfo[0].Checkin));





实际上这



Actually this

result.reservationInfo[0].Checkin

从我在c#中的pagemethod函数给出2016/03/10,其值来自我的数据库。

但在Jquery中它将当前日期时间2016/04/24传递给lblCheckinViewoData。

我不知道是不是因为这个setDate参数。



请帮我从我的数据库中获取真正的价值导致价值sql server是2016/03/10



我尝试过:



gives 2016/03/10, from my pagemethod function in c# which the value is coming from my database.
But in Jquery it is passing a current datetime which is 2016/04/24 to a lblCheckinViewoData.
I dont know if it is because of this setDate parameter.

Please help me getting the real value from my database cause the value in sql server is 2016/03/10

What I have tried:

PageMethods.GetReservationById(aData[index], function (response) {
                    var result = eval("(" + response + ")");
                      if (


' #<%= lblCheckinViewoData.ClientID%>')。length > 0 ){
('#<%=lblCheckinViewoData.ClientID%>').length > 0) {


#<%= lblCheckinViewoData.ClientID%>)。datepicker({dateFormat: yy / mm / dd})。datepicker( setDate,(result.reservationInfo [ 0 ]。签到));
("#<%=lblCheckinViewoData.ClientID%>").datepicker({ dateFormat: "yy/mm/dd" }).datepicker("setDate", (result.reservationInfo[0].Checkin));


这篇关于如何使用jquery从C#获取日期时间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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