Adding an additional option to a bound dropdown list

Discussion in 'ASP .Net' started by estafford, Nov 18, 2004.

  1. estafford

    estafford Guest

    I have a dropdownlist control that is filled using a database query.
    I also want to add an additional option to the list that is not pulled from
    the database.
    How can I go about doing that?

    I've tried adding a list item to the control, but that seems to be
    overwritten by the databinding.

    Thanks for any help
    ES
     
    estafford, Nov 18, 2004
    #1
    1. Advertising

  2. Add it after DataBind() using Items.Add, or Items.Insert if you need it at a
    specific location.

    HTH,

    bill

    "estafford" <estafford your pants @newmancom.com> wrote in message
    news:%...
    > I have a dropdownlist control that is filled using a database query.
    > I also want to add an additional option to the list that is not pulled

    from
    > the database.
    > How can I go about doing that?
    >
    > I've tried adding a list item to the control, but that seems to be
    > overwritten by the databinding.
    >
    > Thanks for any help
    > ES
    >
    >
     
    William F. Robertson, Jr., Nov 18, 2004
    #2
    1. Advertising

  3. estafford

    estafford Guest

    Brilliant!
    Thanks William.

    I was using items.Add but it placed the option at the end of the list and I
    had to write extra code to have it selected by default. The Items.Insert was
    exactly what I needed.

    Thank You for you help...
    ES

    "William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
    news:...
    > Add it after DataBind() using Items.Add, or Items.Insert if you need it at

    a
    > specific location.
    >
    > HTH,
    >
    > bill
    >
    > "estafford" <estafford your pants @newmancom.com> wrote in message
    > news:%...
    > > I have a dropdownlist control that is filled using a database query.
    > > I also want to add an additional option to the list that is not pulled

    > from
    > > the database.
    > > How can I go about doing that?
    > >
    > > I've tried adding a list item to the control, but that seems to be
    > > overwritten by the databinding.
    > >
    > > Thanks for any help
    > > ES
    > >
    > >

    >
    >
     
    estafford, Nov 18, 2004
    #3
    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. =?Utf-8?B?S2V2aW4gSm9obnNvbg==?=

    Syste.Drawing.Color bound to a dropdown list

    =?Utf-8?B?S2V2aW4gSm9obnNvbg==?=, May 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,769
    Joe Fallon
    May 24, 2004
  2. Simon Harvey
    Replies:
    2
    Views:
    424
    Christopher Reed
    Jan 18, 2006
  3. RSH
    Replies:
    1
    Views:
    410
    Mark Rae
    Jan 2, 2007
  4. Bostonasian
    Replies:
    1
    Views:
    963
    Bostonasian
    Feb 14, 2005
  5. Replies:
    7
    Views:
    273
Loading...

Share This Page