Dropdownlist.SelectedValue ISSUE

Discussion in 'ASP .Net' started by Sudhir, Feb 26, 2004.

  1. Sudhir

    Sudhir Guest

    Hi,
    I have a dropdownlist, which I am creating during runtime. I am then
    populating it dynamically. Depeding on a condition, I am changing the
    selected value. After this I am adding the dropdown to a panel. But
    the dropdown is not showing the new selected value when the page
    loads. Does anyone had similar problems? Any help is greatly
    appreciated.

    Thanks,
    Sudhir
    Sudhir, Feb 26, 2004
    #1
    1. Advertising

  2. > I have a dropdownlist, which I am creating during runtime. I am then
    > populating it dynamically. Depeding on a condition, I am changing the
    > selected value. After this I am adding the dropdown to a panel. But
    > the dropdown is not showing the new selected value when the page
    > loads. Does anyone had similar problems? Any help is greatly
    > appreciated.



    Sudhir, try doing something like:

    Dim lb as ListItem = myDDL.Items.FindByValue(value to look for)
    If Not lb Is Nothing Then lb.Selected = True


    See if that doesn't do the trick... :)

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com
    http://www.ASPFAQs.com
    http://www.ASPMessageboard.com

    * When you think ASP, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], Feb 26, 2004
    #2
    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. Jesse
    Replies:
    3
    Views:
    1,232
    DudeGuy
    Jul 24, 2003
  2. Tom Jorgenson
    Replies:
    3
    Views:
    7,022
  3. gu4y
    Replies:
    4
    Views:
    6,760
    mngates
    Jan 13, 2010
  4. Thomas Kern
    Replies:
    1
    Views:
    411
    =?Utf-8?B?YWxhc3Bpbg==?=
    Nov 9, 2004
  5. TSA
    Replies:
    1
    Views:
    725
Loading...

Share This Page