set selectedvalue on dropdown in datagrid

G

Guest

I have a datagrid that includes a dropdown in an edit template. It creates
ok, but i'm not sure how to set the selectedvalue based on the table in the
dataset.
given that the dataset DsSubTypes1 what is the best way to get the current
value. If it can be taken from the datagrid i'd like to know how.
My sub to populate the dropdownlist is below.
thanks
kes
If e.Item.ItemType = ListItemType.EditItem Then
Dim thsddl As DropDownList =
e.Item.Cells(4).Controls(0).FindControl("ddlTF")
thsddl.DataSource = DsSubTypes1
thsddl.DataTextField = "TFDesc"
thsddl.DataValueField = "TFValue"
thsddl.DataBind()

'thsddl.SelectedValue =
End If
 
G

Guest

Ok I can get it to work, but i'm using a hidden databound column. Is there a
better way?
 

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,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top