I found a bug with the AutoCompleteExtender and added the bug to the CodePlex Project. I know this forum is not the place to post bugs, but I just want to make people aware of it. Below is the link to the bug
http://www.codeplex.com/AjaxControlToolkit/WorkItem/View.aspx?WorkItemId=18622
Further research indicates that the focus javascript statement that ASP.NET generates executes before the AutoCompleteExtender is initialized:
<script type="text/javascript">
//<![CDATA[
WebForm_AutoFocus('tb');Sys.Application.initialize();
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.AutoCompleteBehavior, {"delimiterCharacters":"","id":"tb_AutoCompleteExtender","serviceMethod":"GetCompletionList","servicePath":"/DWHomeExchange/Default2.aspx","useContextKey":true}, null, null, $get("tb"));
});
//]]>You can avoid this by using the javascript ScriptManager pageLoad event to set focus which will happen after the Extender is initialized:
ScriptManager.RegisterStartupScript(this, this.GetType(), "focus", String.Format("function pageLoad() {{document.getElementById('{0}').focus();}}", tb.ClientID), true);
JoNaS
MVP - Microsoft Most Valuable Professional
MCAD - Microsoft Certified Application Developer
http://www.jstawski.com