ASP.NET Reset Controls to default values question

Discussion in 'ASP .Net' started by psinyc, Aug 6, 2003.

  1. psinyc

    psinyc Guest

    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
     
    psinyc, Aug 6, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Kellner

    How to reset the colors of a Label to Default

    Peter Kellner, Apr 19, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    384
    Peter Kellner
    Apr 19, 2006
  2. Bob Rock
    Replies:
    1
    Views:
    637
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
  3. Thom Little

    Reset DropDown to Default

    Thom Little, Aug 5, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    146
    Thom Little
    Aug 5, 2004
  4. Joey Martin

    Reset to default in SQL

    Joey Martin, Nov 15, 2003, in forum: ASP General
    Replies:
    2
    Views:
    124
    Joey Martin
    Nov 15, 2003
  5. Jake Barnes
    Replies:
    1
    Views:
    81
Loading...

Share This Page