Help with ajax auto suggestion textbox asp.net 1.1
Posted on 2006-11-07
Hello experts, I am trying to create a suggest textbox for a asp.net web page I am developing. I found lots of code but is not in vb.net. My main problem is how do I select only the suggested text in the textbox so that the user can keep typing?
Here is my ajax codebehind function that retrieves the suggestions from the database
Function check_name(ByVal first_name As String) As String
Dim ssql As String
Dim firstname As String
ssql = "Select First_name from tablename where First_Name like '" & first_name.ToUpper & "%'"
Dim dr As OracleDataReader
dr = GetData(ssql)
If dr.HasRows = True Then
firstname = dr.GetString(0)
Dim int As Integer = first_name.Length
Return firstname.Remove(0, int).ToLower
document.getElementById('txtfirstname').value += check_name(document.getElementById('txtfirstname').value)
<a onkeyup="checkname();"><asp:textbox id="txtfirstname" runat="server" BackColor="Cornsilk"></asp:textbox></a>
So basically if I have a firstname of steve in the database, and I type "s" in the textbox I would return the "teve", my problem is I need to select only the "teve" text so that the user can keep typing, any ideas?