Dropdownlist.SelectedValue ISSUE

  • Thread starter Thread starter Sudhir
  • Start date Start date
S

Sudhir

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
 
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
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
Back
Top