I have the following statement to fill a DropDownList from sql server ...
myconnection = New SqlClient.SqlConnection("Server=myserver;Database=my_database;Trusted_Connection=yes")
myda = New SqlClient.SqlDataAdapter("Select status from STATUS_VW order by status", myconnection)
ds = New DataSet
status.DataSource = ds
status.DataSource = ds.Tables(0)
status.DataTextField = ds.Tables(0).Columns("status").ColumnName.ToString()
Dim ii As Integer
For ii = 0 To status.Items.Count - 1
status.Items.Insert(0, New ListItem("Select", 0))
I would like to have an item pre-selected in the dropdown based on a flag on the table called default_select.
How can I get the SelectedText to be from a second query where default_select = 1 ? or do I even need a second query?
many thanks in advance