0

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

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Ana D.
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.