Let’s consider that I have two date fields.
DateTime dt1 = "01/04/2012"
DateTime dt2 = "31/08/2012"
Here my dates are in “DD/MM/YYYY” format. Here dt1 is the start date and dt2 is the end date. As from the two date fields, I can be able to know that it lies in 04,05,06,07,08 months.
So I want to show on my dropdown list items as combination of month and year.
04/2012
05/2012
06/2012
07/2012
08/2012
How can I achieve this?
Something like below will give you a list of string, that you can use to bind to the drop down.
If you output it using foreach you will get:
Later if its ASP.Net (because you used dropdownlist), you can do