jQuery 仅在 asp.net 中的时间选择器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16070984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Time picker ONLY in asp.net
提问by Gavin
I am creating an vb.net page. The page is to allow users to schedule lectures, appointments etc. I have a few text boxes to add the details. I have used the asp:calendar control to select the days. However I cannot find a time picker. To be clear I have three textboxes. One for day, one for start time and one for end time. All I want is a time picker. When a user clicks a button or link a list pops up with times of the day. The user clicks whichever time and I can get that time and store it in a variable to pass to my database, just like the calendar control. Is that too much to ask. Has anyone got an answer here. I know this has been asked a multitude of times and I know there are answers out there but I have spent 9 hours so far playing around with the solutions out there, with no success, so I hoping please please please that someone here can help me. I'm desperate and fed up, and it's probably my incompetence.
我正在创建一个 vb.net 页面。该页面允许用户安排讲座、约会等。我有几个文本框可以添加详细信息。我使用了 asp:calendar 控件来选择日期。但是我找不到时间选择器。明确地说,我有三个文本框。一个是一天,一个是开始时间,一个是结束时间。我想要的只是一个时间选择器。当用户单击按钮或链接时,会弹出一个包含当天时间的列表。用户点击任意时间,我可以获取该时间并将其存储在变量中以传递到我的数据库,就像日历控件一样。那是过分的要求。有没有人在这里得到答案。我知道这已经被问过很多次了,我知道那里有答案,但到目前为止我已经花了 9 个小时来研究那里的解决方案,但没有成功,所以我希望请在这里有人可以帮助我。我绝望了,受够了,这可能是我的无能。
采纳答案by Gavin
Thanks for the suggestions guys. I actually found a really good one myself at http://www.codeproject.com/Articles/213311/Time-Picker-Ajax-Extender-Control
谢谢各位的建议。实际上,我自己在http://www.codeproject.com/Articles/213311/Time-Picker-Ajax-Extender-Control 上找到了一个非常好的
It was very easy to use. Just drag in the two folders "Binaries" and "Ajaxified" into your project. Then, in the toolbox, right click and choose new item. Navigate to the biaries folder in your solution and select the ajaxified.dll. This will add the timepicker to your toolkit. You can drag it onto your page. As it is an extender it has to be added to a target. This will normally be a textbox. It can be defined by the TargetControlID="xxxxx
control.
它非常容易使用。只需将两个文件夹“Binaries”和“Ajaxified”拖入您的项目中。然后,在工具箱中,右键单击并选择新项目。导航到解决方案中的 biaries 文件夹并选择 ajaxified.dll。这会将时间选择器添加到您的工具包中。您可以将其拖到您的页面上。由于它是一个扩展器,因此必须将其添加到目标中。这通常是一个文本框。它可以由TargetControlID="xxxxx
控件定义。
I know this may be an overly specific guide but these things are only easy when you know how. And 10 horrible hours late I can say I know how now.
我知道这可能是一个过于具体的指南,但只有当您知道如何操作时,这些事情才会变得容易。晚了 10 个可怕的小时,我可以说我现在知道了。
NB It is a good idea to put the timepicker in a table cell with your target control, for formatting reasons. Mine are also enclosed in DIV's
注意,出于格式原因,将时间选择器与目标控件一起放在表格单元格中是个好主意。我的也包含在 DIV 中
回答by Harsh Baid
Try using the jQuery Timepickerit has many cool features such as
尝试使用jQuery Timepicker它有许多很酷的功能,例如
- Timezones support
- DateTime picker
- Time picker
- Jquery UI theming support and many other tweaks.
- 时区支持
- 日期时间选择器
- 时间选择器
- Jquery UI 主题支持和许多其他调整。
Usage is very simple and effective
使用方法非常简单有效
Example with date and time picker
日期和时间选择器示例
HTML
HTML
<input type="text" name="basic_example" id="basic_example" class="hasDatepicker">
Javascript
Javascript
$('#basic_example').datetimepicker();
Screenshot
截屏
回答by Roar
there is the simplest way
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx
有最简单的方法
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx
<asp:Textbox Id="Date1" runat="server" />
<ajaxToolkit:Calendar runat="server"
TargetControlID="Date1"
CssClass="ClassName"
Format="MMMM d, yyyy"
PopupButtonID="Image1" />
and time picker like this
http://trentrichardson.com/examples/timepicker/