Author: chris22smith | Posted on: 9/3/2007 11:46:03 AM | Views : 417

I want to include 3 date of birth fields in a web form using 3 dropdownlist controls, day with options from 1 to 31, month January to December and then year running from 1900 to 2007. Nothing difficult in that.
I'm just curious to see if there's a smarter way of doing it than manually adding loads of ListItems (options). I realise I can bind each control to a datasource, for example, a simple XML file containing all the data for each, but this is again quite a lengthy coding/data entry process.
Is there a way of iterating through the days starting at 1 and stopping at 31, and the years starting at 1900, stopping at 2007 so that I don't have to manually list each one as a new option value?
Taking it a stage further, it would be even better to dynamically grab the current year and list all the years from the current year to current year minus 100.
Any thoughts?
 
...

Go to the complete details ...