Hellow,
I'm trying to add list items to dropdown list for date depending on month and year. It is supposed to show the number of days depending on month as well as 28 or 29 days for the month of febravary. I'm using the following code. But I'm getting an error "Use of unassigned local variable 'year' ". I'm not understanding where my code is going wrong. please help me.
here is my code:
// to store the month in month dropdownlist
for (int i = 1; i <= 12; i++)
{
DateTime month = new DateTime(2000, i, 1);
ListItem li = new ListItem(month.ToString("MMM "), month.ToString("MM"));
ddlmm.Items.Add(li);
}
ddlmm.Items[0].Selected = true;
Go to the complete details ...