Hi,

In the page I'm developing, I have a CheckBoxList which is populated based on what the user types in a TextBox (Similar to an AutoSuggest). The CheckBoxList is inside an UpdatePanel. When anything is typed, I'm settting the focus to the end of the word, otherwise the focus goes to the beginning.
The code for populate the CheckBoxList is working well, but the problem is, if the user types too fast, the word in the textBox becomes a mess. Does anyone knows how to speed up the AutoSuggest?
My code:
In the Page_Load:

If myTextBox.Visible = True Then
        myTextBox.Attributes.Add("onkeyup", "javascript:setTimeout('__doPostBack(\'" & myTextBox.ClientID & "\',\'\')', 0)")
        myTextBox.Attributes.Add("onfocus", "javascript:setSelectionRange('" & myTextBox.ClientID & "','')")
        myTextBox.Focus()
End If

myTextBox_TextChanged:
A basic query to retrieve the values from the database.

JavaScriptCode to set the focus:

function setSelectionRange(TextBox) {
        var inputField = document.getElementById(TextBox);
        if (inputField != null && inputField.value.length != 0) {
            if (inputField.createTextRange) {
                var FieldRange = inputField.createTextRange();
                FieldRange.moveStart('character', inputField.value.length);
                FieldRange.collapse();
                FieldRange.select();
            }
        }
}

Thanks in advance,

Ana

A way reduce the time CheckBoxList takes to be populated is caching the results. So, my question is: how do I cache the results from the query? I'm using a DataTable to populate the CheckBoxList.

Thanks,

Ana

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.