Ali Hasan
Ali Hasan

Reputation: 1075

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

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

using two dropdowns ie. 1 for day and the other for month + year. 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

Upvotes: 0

Views: 1723

Answers (2)

Chase
Chase

Reputation: 564

jQuery mobile has a datepicker. Do not try and re-invent the wheel.

Upvotes: 1

4imble
4imble

Reputation: 14426

In that case this might help.

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.


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):

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

Upvotes: 3

Related Questions