Hi @Aleks Mavrič ,
You can try to download nuget package --AjaxControlToolkit to create input field dropdown.
You can refer to the example below.
<ajaxToolkit:ComboBox ID="cbCustomers" runat="server" AutoCompleteMode="SuggestAppend">
</ajaxToolkit:ComboBox>
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Using con As SqlConnection = New SqlConnection("Data Source=***")
Using cmd As SqlCommand = New SqlCommand("SELECT * FROM Products", con)
Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
cbCustomers.DataSource = dt
cbCustomers.DataTextField = "ProductName"
cbCustomers.DataValueField = "ProductID"
cbCustomers.DataBind()
End Using
End Using
End Sub
Protected Sub Submit(ByVal sender As Object, ByVal e As EventArgs)
Dim message As String = "Selected Text: " & cbCustomers.SelectedItem.Text
message += "\nSelected Value: " & cbCustomers.SelectedItem.Value
ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('" & message & "');", True)
End Sub
End Class
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.