我需要自动填充文本框,在您键入时填充文本框并填充下拉列表,例如浏览器地址栏:
您只需点击标签即可填写要填写的文本框,然后转到下一页控件。我有自动完成工作正常,我只需要填充文本框。我不知道从哪里开始。
编辑:我将自动完成代码放在JSFiddle上,但它不会填充下拉列表,因为Web方法托管在它所在的Intranet之外。无法访问数据库。我不知道这是否有帮助。
http://jsfiddle.net/pixelmeow/noabLz7k/
网络方法:
<WebMethod()> _
Public Function GetScopes(ByVal sLookUP As String) As String()
Dim scopes As New List(Of String)()
Using conn As New SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings("xConnectionString").ConnectionString
Using cmd As New SqlCommand()
cmd.CommandText = "SELECT JobScopeDesc, JobScopeID FROM view_JobScopeCode where JobScopeDesc like '%' + @SearchText + '%' ORDER BY JobScopeDesc"
cmd.Parameters.AddWithValue("@SearchText", sLookUP)
cmd.Connection = conn
conn.Open()
Using sdr As SqlDataReader = cmd.ExecuteReader()
While sdr.Read()
scopes.Add(String.Format("{0}-{1}", sdr("JobScopeDesc").ToString(), sdr("JobscopeID")))
End While
End Using
conn.Close()
End Using
Return scopes.ToArray()
End Using
End Function