Code:
Sub Page_Load(Source As Object, E As EventArgs)
if Not Page.IsPostBack Then
Dim oConn As SQLConnection
Dim oComm As SQLCommand
Dim oReader As SQLDataReader
Dim sSQL As String
Dim sConn As String
sSQL= "SELECT location_code, location from agencies "
sConn= "server=svr-test\sqlexpress;database=test;Trusted_Connection=yes"
oConn = New SQLConnection(sConn)
oConn.Open()
oComm = New SQLCommand(sSQL,oConn)
oReader = oComm.ExecuteReader()
oTempAgency.DataSource = oReader
oTempAgency.DataBind()
end if
End Sub
Code:
<asp:DropDownList ID="oTempAgency" DataTextField="location_code" DataValueField="location_code" Label="csidTempAgency" Runat="server">
<asp:ListItem Value="">Please Select</asp:ListItem>
</asp:DropDownList>
First block is in my <script></script> and second is in the page. It works fine in that it pulls the query and displays them in the dropdownlist. But I want the first option to be Please Select or empty. Any ideas?