开发者

ASP.NET Datepicker without calendar visualization

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 开发者_如何学Pythondate (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?


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.


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's datepicker might be what you want: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜