简体   繁体   English

使用MVC Razor的C#下拉日历为1年

[英]C# Dropdown calendar for 1 year with MVC Razor

New to razor and mvc, how to create a 1 year calendar in dropdown list starting from 剃须刀和MVC的新功能,如何在下拉列表中从1开始创建1年日历

var dt = System.DateTime.Now.AddDays(7);

using two dropdowns ie. 使用两个下拉菜单,即。 1 for day and the other for month + year. 1个代表日,另一个代表月+年。 for example if i change the month + year ddl to "feb 2012" the day ddl must display 1 - 28 items if change the month + year ddl to "jan 2012" the day ddl must display 1 - 31 items 例如,如果我将月份+年ddl更改为“ feb 2012”,则日期ddl必须显示1-28项;如果将月份+年ddl更改为“ jan 2012”,则日期ddl必须显示1-31项

In that case this might help. 在这种情况下,这可能会有所帮助。

http://jquerymobile.com/demos/1.0a4.1/experiments/ui-datepicker/ http://jquerymobile.com/demos/1.0a4.1/experiments/ui-datepicker/

I just viewed the demo on my mobile in opera mini and it worked great. 我刚刚在Opera mini的手机上观看了该演示,效果很好。


Alternatively if the drop downs are the way you want to go: 或者,如果下拉列表是您要使用的方式:

You could do it using jquery like so (Razor is not an issue here): 您可以像这样使用jquery来做到这一点(Razor在这里不是问题):

http://jsfiddle.net/Kohan/drrHH/ http://jsfiddle.net/Kohan/drrHH/

jQuery mobile has a datepicker. jQuery mobile具有日期选择器。 Do not try and re-invent the wheel. 不要尝试重新发明轮子。

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

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