dropdownlist; setting selected in a databind

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!
 
G

Guest

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

Thanks, MikeL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top