.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Automatic binding of Days, Months, Years to a dropdown list control

Posted By:Suthish Nair       Posted Date: September 22, 2010    Points: 5    Category: C#    URL: http://www.dotnetspark.com  

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.
 

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.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend