为什么datepicker只能在我的机器上正常工作? [英] Why is datepicker working fine on my machine only?

查看:93
本文介绍了为什么datepicker只能在我的机器上正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用datepicker UI Jquery插件。在ASP.net webform中,我给出了一个gridview,其中一列由< asp:label>组成。控制和控制。



标签的文本值与隐藏输入控件的值相同 - 日期列表。



我在这一列的每一行都有一个日期选择器,它的默认日期设置为输入控件的值。这在我的机器上工作正常。当我运行webform时,网格加载并且列中是datepicker的图标,标签文本将日期显示为字符串。单击图标时,datepicker显示与标签相同的日期。但是,当我的朋友运行完全相同的源代码时,每列的默认日期都设置为今天的日期!?据我所知,一切都是相同的,所以它可能是表现不同的原因?



这里是日期选择代码:



I am using the datepicker UI Jquery plugin. In an ASP.net webform I gave a gridview and one of the columns is composed of an <asp:label> control and an control.

The text value of the label is the same as the value of the hidden input control - a list of dates.

I have a datepicker in every row of this column which has its default date set to the value from the input control. This works fine on my machine. When I run the webform the grid loads and in the column is an icon for the datepicker and the label text showing the date as a string. When I click the icon the datepicker displays the same date as the label. However, when my friends run the exact same source code the default date for every column is set to todays date!? As far as I can tell everything is identical so what could possibly be the reason for it to behave differently?

here is the datepicker code:

    $(function () {
$(".picker").datepicker({
showOn: "button",
buttonImage: "/images/calendar2.png",
buttonImageOnly: true,
buttonText: "calender"
});
$(".picker").datepicker("setDate", $(".picker"))
});





这里是gridview控件的代码:





and here is the code for the gridview controls:

          <ItemTemplate>
<asp:Label ID="lblDate" runat="server"
Text='<%# Convert.ToDateTime(Eval("Date")).ToString("MM/dd/yyyy") %>'    Height="15%"></asp:Label>
<input type="hidden" class="picker" id="datepicker"
value='<%# Convert.ToDateTime(Eval("Date")).ToString("MM/dd/yyyy") %>'/>
</ItemTemplate>





我在这里缺少什么?任何有用的帮助:D



我尝试过:



我试图在没有显示正确日期的机器上硬编码日期,这没有问题。看起来像datepicker正在我的机器上找到输入值而不是他们的输入值,即使id和数据源是相同的。



What am I missing here? Any help much appreiated :D

What I have tried:

I have tried to hardcode a date on the machines that are not showing the correct dates and this works without issue. It just seems like datepicker is finding the input value on my machine but not on theirs even though the id's and datasource are the same.

推荐答案

function (){


.picker)。datepicker({
showOn: button
buttonImage: / images / calendar2.png
buttonImageOnly:< span class =code-keyword> true ,
buttonText: calender
});
(".picker").datepicker({ showOn: "button", buttonImage: "/images/calendar2.png", buttonImageOnly: true, buttonText: "calender" });


。picker).datepicker( setDate
(".picker").datepicker("setDate",


这篇关于为什么datepicker只能在我的机器上正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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