dropdownlist; setting selected in a databind

  • Thread starter Thread starter asptodotnet
  • Start date Start date
A

asptodotnet

I have created a function that generates states and I now need to figure out
how to read the values from it and then set one of the options to selected.
Here is the code that I currently have, but it doesn't work.

Dim hf As New helperfunctions()

stateprovincedropdown.DataTextField = "text"

stateprovincedropdown.DataValueField = "value"

stateprovincedropdown.DataSource =
hf.BindStatesDropDownList(advertiser.BillingAddress.StateProvince.ToCharArra
y)

stateprovincedropdown.DataBind()

If advertiser.BillingAddress.StateProvince.ToUpper =
stateprovincedropdown.SelectedItem.Value Then

stateprovincedropdown.SelectedItem.Selected = True

End If



Thanks!
 
What is advertister and BillingAddress. Can you give me some simplified code
and I will figure it out.

Thanks, MikeL.
 
Back
Top