简体   繁体   English

显示jQuery日期时间选择器onclick

[英]Show Jquery Date time picker onclick

I am using a ASP.NET GRIDVIEW. 我正在使用ASP.NET GRIDVIEW。 The column I am interested in is the "CHECKED IN" column that contains a checkbox and a label. 我感兴趣的列是“ CHECKED IN”列,其中包含一个复选框和一个标签。

Grid View Image 网格视图图像

The grid can bring back many lines of data from the database: 网格可以从数据库中带回许多数据行:

Columns of grid 网格列

Here's what I need to do: 这是我需要做的:

  1. When the 'Checked IN' checkbox is clicked. 单击“签入”复选框。 I would like the DataTime picker to appear. 我希望出现DataTime选择器。 [Checkbox is checked and Datatime picker appears][3] [选中复选框并显示数据时间选择器] [3]

checked in Checkbox 2. When the user has selected a date and time, I would like the value to appear in the label next to the Checked in checkbox. 在复选框2中选中。当用户选择日期和时间后,我希望该值显示在“复选框”旁边的标签中。 DateTime to show only when it has been selected. DateTime仅在选择时显示。

[Label is updated][4] [标签已更新] [4]

Hope this makes sense? 希望这有意义吗?

The only issue is that the GridView creates itself dynamically. 唯一的问题是GridView是动态创建的。

Thanks for your message. 感谢您的留言。

I did resolve this, however I slightly changed what I was doing. 我确实解决了这个问题,但是我做了些改动。

Here's my code... 这是我的代码...

    $(".CheckOut").each(function () {
        $(this).datetimepicker({
            dateFormat: 'dd/mm/yy',
            onClose: function (selectedDateTime) {

                return Validate(this, this.id);
            }
        });
    });

This code is exactly what I needed for the date/time picker to work within a GridView. 这段代码正是我在GridView中使用日期/时间选择器所需要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM