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. Advertisements

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. cjbland
    Replies:
    0
    Views:
    1,782
    cjbland
    Feb 24, 2006
  2. Peter Kellner

    How to reset the colors of a Label to Default

    Peter Kellner, Apr 19, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    450
    Peter Kellner
    Apr 19, 2006
  3. Bob Rock
    Replies:
    1
    Views:
    909
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
  4. JDeats
    Replies:
    1
    Views:
    534
    Masudur
    Oct 29, 2007
  5. Andy B

    Default size of asp.net controls

    Andy B, Sep 8, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    340
    Andy B
    Sep 8, 2008
  6. Praveen Ramesh

    Specifying dynamic default values for properties in custom controls:

    Praveen Ramesh, Sep 2, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    206
    Praveen Ramesh
    Sep 2, 2004
  7. Thom Little

    Reset DropDown to Default

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

    Reset to default in SQL

    Joey Martin, Nov 15, 2003, in forum: ASP General
    Replies:
    2
    Views:
    190
    Joey Martin
    Nov 15, 2003
Loading...