P
psinyc
this may be a simple thing ... I am trying to reset all
the page controls to their original setting, in the first
line of this method call (event). I want to dynamically
change the days of month in a dropdownlist list depending
on the users selected month in the month's
dropdownlist ... i am using AutoPostBack on the
dropdownlists ... can anyone offer suggestions? Thanks ..
here's the method ..
private void ddlStartMonth_SelectedIndexChanged(object
sender, System.EventArgs e)
{
// need to reset all page controls to original setting
if (ddlStartMonth.SelectedItem.Value == "2")
{
ddlStartDay.Items.RemoveAt(33);
ddlStartDay.Items.RemoveAt(32);
ddlStartDay.Items.RemoveAt(31);
}
else if (ddlStartMonth.SelectedItem.Value == "4")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "6")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "9")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "11")
{
ddlStartDay.Items.RemoveAt(33);
}
}
what happens is the first month selected works, but now
the items have been removed from the dropdownlist, so the
second time the method is called, it's not working with
the full, default 31 day dropdownlist.
Sorry for the lengthy post, thanks ..
psinyc
the page controls to their original setting, in the first
line of this method call (event). I want to dynamically
change the days of month in a dropdownlist list depending
on the users selected month in the month's
dropdownlist ... i am using AutoPostBack on the
dropdownlists ... can anyone offer suggestions? Thanks ..
here's the method ..
private void ddlStartMonth_SelectedIndexChanged(object
sender, System.EventArgs e)
{
// need to reset all page controls to original setting
if (ddlStartMonth.SelectedItem.Value == "2")
{
ddlStartDay.Items.RemoveAt(33);
ddlStartDay.Items.RemoveAt(32);
ddlStartDay.Items.RemoveAt(31);
}
else if (ddlStartMonth.SelectedItem.Value == "4")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "6")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "9")
{
ddlStartDay.Items.RemoveAt(33);
}
else if (ddlStartMonth.SelectedItem.Value == "11")
{
ddlStartDay.Items.RemoveAt(33);
}
}
what happens is the first month selected works, but now
the items have been removed from the dropdownlist, so the
second time the method is called, it's not working with
the full, default 31 day dropdownlist.
Sorry for the lengthy post, thanks ..
psinyc