B
Bengt-Erik Eliasson
Hi!
I want to add a default choice at the top of an DropDownList
(DataValueField="", DataTextField="Select an alarm site..."). How do I do
this with an databound control?
Must I move the result from the SqlCommand to another format (DataView,
DataList or so) and use that as DataSource?
Please attach example or a link to help me in the right direction...
Dim strSQL As String = "SELECT Alarm_site, Alarm_Site_Id FROM Alarms GROUP
BY Alarm_Site_Id ORDER BY Alarm_Site"
Dim objCmd As SqlCommand = New SqlCommand(strSQL, objConn)
objConn.Open()
cboAl_site.DataSource = objCmd.ExecuteReader()
cboAl_site.DataValueField = "Alarm_Site"
cboAl_site.DataTextField = "Alarm_Site_Id"
cboAl_site.DataBind()
objConn.Close()
Thanks in advance Bengt-Erik
I want to add a default choice at the top of an DropDownList
(DataValueField="", DataTextField="Select an alarm site..."). How do I do
this with an databound control?
Must I move the result from the SqlCommand to another format (DataView,
DataList or so) and use that as DataSource?
Please attach example or a link to help me in the right direction...
Dim strSQL As String = "SELECT Alarm_site, Alarm_Site_Id FROM Alarms GROUP
BY Alarm_Site_Id ORDER BY Alarm_Site"
Dim objCmd As SqlCommand = New SqlCommand(strSQL, objConn)
objConn.Open()
cboAl_site.DataSource = objCmd.ExecuteReader()
cboAl_site.DataValueField = "Alarm_Site"
cboAl_site.DataTextField = "Alarm_Site_Id"
cboAl_site.DataBind()
objConn.Close()
Thanks in advance Bengt-Erik