I have two Drop down list.
First drop down is list of months and second is for days.
I want when I select month from first drop down, items of second dropdown change according to selection of first dropdown.
For Example- if I select January from first dropdown, second drop down list become 1 to 31. On selction of february, second drop down list become 1 to 29.
I am trying with this code but not working-
protected void Page_Load(object sender, EventArgs e)
    {
        getDays(dropdownMonth.SelectedValue);
    }
public void getDays(string selectedMonth)
    {
        int i = 0;
         dropdownDays.Items.Clear();
        switch (selectedMonth)
        {
            case "January":
                i = 31;
                break;
            case "February":
                i = 29;
                break;
            case "March":
                i = 31;
                break;
            case "April":
                i = 30;
                break;
            case "May":
                i = 31;
                break;
            case "June":
                i = 30;
                break;
            case "July":
                i = 31;
                break;
            case "August":
                i = 31;
                break;
            case "September":
                i = 30;
                break;
            case "October":
                i = 31;
                break;
            case "November":
                i = 30;
                break;
            case "December":
                i = 31;
                break;
        }
        for (int j = 1; j <= i; j++)
        {
            dropdownDays.Items.Add(j.ToString());
        }
        int Month = DateTime.ParseExact(Convert.ToString(dropdownMonth.SelectedValue), "MMMM", CultureInfo.CurrentCulture).Month;
        int day = Convert.ToInt32(dropdownDays.SelectedValue);
        int year = DateTime.Now.Year;
        DateTime date = new DateTime(year, Month, day);
        lblEndDateValue.Text = String.Format("{0:dd MMMM}", date.AddDays(-1));
if i remove dropdownmonth.items.clear(); from my code then it works but then it adds new days list to previous list on this dropdown.