I am a newbie trying to populate a Months dropdown based on whether the directories exists for the particular month.
I know the directories names will be Jan 2010, Feb 2010, Mar 2015 and so on...
I am currently using...
if (System.IO.Directory.Exists("C:\\Desktop\\Month\\Jan\\"))
{
DropDownList1.Items.Add("Jan 2015");
}
if (System.IO.Directory.Exists("C:\\Desktop\\Month\\Feb\\"))
{
DropDownList1.Items.Add("Feb 2015");
}
if (System.IO.Directory.Exists("C:\\\Desktop\\Month\\March\\"))
{
DropDownList1.Items.Add("March 2015");
}
How can I make this easier. I just want to loop through and if directory exists add particular name to the dropdown.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire