没有日历可视化的 ASP.NET Datepicker
我正在使用 C# / ASP.NET 3.5 工作,希望用户能够输入他们的出生日期。我已经尝试过 asp:Calendar Web 控件,还考虑使用 jQuery-UI datepicker,并查看了 这个问题。
所有这些选项似乎都没有我想要的“模式”。我不希望弹出实际的日历,而只是弹出日/月/年下拉列表。我的要求:
- 只有三个下拉列表,分别用于日/月/年
- 能够设置最小和最大年份
- 客户端解决方案可帮助选择有效日期(因此不允许 30 + 二月)
- 最好有:基于文化的日期位置切换/月和月/日
有人可以建议这样的控制吗?或者我应该继续自己构建它?
I'm working in C# / ASP.NET 3.5 and want to enable users to enter their date-of-birth. I've tried the asp:Calendar web control for this, and also considered using the jQuery-UI datepicker, and reviewed suggestions from this question.
All those options don't seem to have the "mode" I want though. I do not want an actual calendar to pop up, but just a Day/Month/Year dropdown. My requirements:
- Just three dropdowns, for day/month/year
- Ability to set a min and max year
- Client side solution for helping pick a valid date (so don't allow 30 + February)
- Nice to have: culture based position switch for day/month and month/day
Can anyone suggest such a control? Or should I just move on and build it myself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Jeroen,没有内置控制。
执行此操作的简单方法是添加 3 个下拉列表并添加所有月份/年份(这些是简单的)。日子会发生变化,因此您可以静态添加 31 并进行一些检查,或者使用保存一堆日期的数据库并将其用作数据源。
Jeroen, there is no built in control.
The simple way to do this is add 3 drop down lists and add all months / years (Those are the simple ones). Days change, so either you can statically add 31 and do some checking, or use a database that holds a bunch of dates and use that as the datasource.
我使用了 jQuery 添加来为我处理这个问题,我能够更新一个可以从后面的 ASP.Net 代码中读取的隐藏字段,抱歉,我不记得确切的插件,但如果你在 jQuery 网站上搜索你应该找到它(我快速浏览了一下,但无法找到它,jQuery 站点搜索是裤子)。
I used a jQuery add in that handled this for me, I was able to update a hidden field that could be read from ASP.Net code behind, sorry I can't remember the exact plug-in but if you search on the jQuery site you should find it (I had a quick look but couldn't track it down, jQuery site search is pants).
jQuery 的日期选择器可能就是你想要的:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/演示/
jQuery's datepicker might be what you want:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/