I want to know how to do the following which I have done in Classic ASP in ASP.Net
VB.
I pass a parameter though the URL string and I want for example a drop down list of departments, with the correct department already selected in the drop down menu based on a foreign key of a personID.
<select name="Team_Jump" id="Team_Jump">
<%
While (NOT RS_Team.EOF)
%>
<option value="Edit_team.asp?seasonID=<%=Request("seasonID ")%>&LeagueID=<%=Request("LeagueID")%>&ClubID=<%=( RS_Team.Fields.Item("ClubID").Value)%>"<% If Request("TeamID")= CStr(RS_Team.Fields.Item("TeamID").Value) Then Response.Write ("Selected") %>><%=(RS_Team.Fields.Item("Team_Name").Value)%>
- <%=(RS_Team.Fields.Item("Division_Number").Value)% ></option>
<%
RS_Team.MoveNext()
Wend
If (RS_Team.CursorType > 0) Then
RS_Team.MoveFirst
Else
RS_Team.Requery
End If
%>
</select>
Here is my ASP.net code that I need to snap to the correct user level value from the database
Sub LoadDropDown()
If Not IsPostBack Then
Dim strConnection As String = MM_Knight_String
Dim strSQLforListBox As String = "SELECT User_Level " & _
"FROM User_Level"
Dim objConnection As New SqlConnection(strConnection)
Dim objCommand As New SqlCommand(strSQLforListBox, objConnection)
objConnection.Open()
ddlEmployees.DataSource = objCommand.ExecuteReader()
ddlEmployees.DataValueField = "User_Level"
ddlEmployees.DataBind()
objConnection.Close()
End If
End Sub
Any help would be greatly appreciated