dynamic DropDownList custom control

Discussion in 'ASP .Net' started by will, Dec 11, 2003.

  1. will

    will Guest

    hi,

    i'm trying to create two custom DropDownLists, DropDownList_Countries
    and DropDownList_Cities

    in DropDownList_Countries, i have a

    public override void DataBind()
    {
    .....
    }

    which runs a SQL query, and eventually base.DataBind();


    in DropDownList_Cities, i have a similar setup but the SQL query
    includes a condition which is from the selection of
    DropDownList_Countries. eg

    "SELECT * FROM tbl_cities WHERE country='" +
    DropDownList_Countries.SelectedItem.Value + "';"


    what i'm trying to achieve is to display two dropdownlists on a webpage,
    DropDownList_Countries has a list of options while DropDownList_Cities
    is empty. as soon as something's selected in DropDownList_Countries,
    this control does a autopostback and at this point, DropDownList_Cities
    should have a list of options derived from the selected country.

    however, i can't build this .dll, it says DropDownList_Countries cannot
    be found. obviously DropDownList_Countries.SelectedItem.Value is not the
    correct way to express the selected value. what shoud i do?

    thanks

    will.
    will, Dec 11, 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. Jonah Olsson
    Replies:
    1
    Views:
    564
    Scott Allen
    Apr 5, 2005
  2. J R M
    Replies:
    2
    Views:
    420
    Charlie@CBFC
    Jun 1, 2006
  3. Larry Bud
    Replies:
    1
    Views:
    339
    bruce barker
    Jan 10, 2007
  4. RichB
    Replies:
    0
    Views:
    374
    RichB
    Sep 24, 2008
  5. Matt Sokol
    Replies:
    2
    Views:
    367
    Theo Tillotson
    Aug 7, 2003
Loading...

Share This Page