<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Client Side Web Development</title><link>http://forums.asp.net/130.aspx</link><description>Client-side programming discussions, including CSS, DHTML, JScript/Javascript, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=18&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Best way to focus and position cursor in textbox</title><link>http://forums.asp.net/thread/3273504.aspx</link><pubDate>Fri, 03 Jul 2009 12:30:57 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273504</guid><dc:creator>DarrellNorton</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273504.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=3273504</wfw:commentRss><description>&lt;p&gt;Are you running into this problem with the ASP.NET AJAX AutoComplete extender?&amp;nbsp; It does not seem to have the problems you do.&amp;nbsp; Check it out to see if it meets your needs (very little JavaScript coding required):&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx"&gt;http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;You can also use a jQuery but that requires a bit more JavaScript and jQuery knowledge.&amp;nbsp; jQuery is supported as part of VS2008 and greater.&lt;/p&gt;&lt;p&gt;Choose whichever one works for you.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Best way to focus and position cursor in textbox</title><link>http://forums.asp.net/thread/3273026.aspx</link><pubDate>Fri, 03 Jul 2009 08:14:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273026</guid><dc:creator>sparrez</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273026.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=3273026</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi&lt;/p&gt;
&lt;p&gt;I&amp;#39;m developing a webpart to search for customers etc., but that is not really the important part.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using an UpdatePanel and need some sort of AutoComplete behavior, nothing advanced or anything. Just a list/table of results that is updated as the user changes the text in the input field. For this I&amp;#39;m using the onKeyUp event to catch keystrokes. But the postback behavior steals focus from the textbox so i use TextBox.Focus() method to set this (could not get at client script to work). This gives focus back to the TextBox but leaves the cursor at the beginning of the field. I then use another client script top change the position of the cursor to the end. This works great, but if you type to fast sometimes it has not moved the cursor when the next onKeyUp event takes place thus loosing some characters.&lt;/p&gt;
&lt;p&gt;This is the code that changes the position:&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt; function SetCursorToTextEnd(elemId) {
            var elem = document.getElementById(elemId);
            alert(window.event.which);
            if (elem != null) {
                if (elem.createTextRange) {
                    var range = elem.createTextRange();
                    range.move(&amp;#39;character&amp;#39;, elem.value.length);
                    range.select();
                }
                else {
                    if (elem.selectionStart) {
                        elem.focus();
                        elem.setSelectionRange(elem.value.length, elem.value.length);
                    }
                    else
                        elem.focus();
                }
            }
        }&lt;/pre&gt;
&lt;p&gt;What would be the best way to implement a simple auto complete behavior for each keystroke in a textbox?&lt;/p&gt;
&lt;p&gt;Hope you can help. JavaScript isn&amp;#39;t my strong side ;)&lt;/p&gt;
&lt;p&gt;-- &lt;br /&gt;Christian&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>