|
|
public void populateDateDrop(string DateType, DropDownList DropListObject)
{
DateTimeFormatInfo dateFormating = new DateTimeFormatInfo();
DropListObject.Items.Insert(0, new ListItem("", ""));
switch(DateType)
{
case "day":
for (int day=1; day<=31; day++)
{
DropListObject.Items.Insert(
day,
new ListItem(day.ToString(), day.ToString())
);
}
break;
case "month":
for (int month=1; month<=12; month++)
{
DropListObject.Items.Insert(
month,
new ListItem(dateFormating.GetMonthName(month),month.ToString())
);
}
break;
case "year":
for (int year=1; year<=35; year++)
{
DropListObject.Items.Insert(
year,
new ListItem((year+1984).ToString(), (year+1984).ToString())
);
}
break;
}
}
populateDateDrop("day", droplistob);
populateDateDrop("month", droplistob);
populateDateDrop("year", droplistob);
|
|
|