Automatic binding of Days, Months, Years to a dropdown list control
This article shows a simple snippet, how to bind days, months and years to a dropdown list.
For binding Days:
Ø System.DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)
ð Gives last day.
For binding DayNames
Ø Doing for-each to retrieve Day Names from DateTimeFormatInfo.CurrentInfo.DayNames
For binding MonthNames
Ø Doing for-each to retrieve Month Names from DateTimeFormatInfo.CurrentInfo.MonthNames
Some styling also used, you can uncomment the code and test the samples attached.

No comments:
Post a Comment