AutoComplete does not work when put focus on that control

P

Pat

Hi ASP Gurus,
Please help me.
Autocomplete works fine when the control does not have the focus when the
page load.
But when I put the focus on page load, then autocomplete does not work.
I even tried javascript pageload code, but with no success.
<script language ="javascript" type ="text/javascript" >
function focusIt() {
//alert('test');
var mytext =
document.getElementById('<%=txtSearch.ClientID%>');
//alert(mytext);
mytext.focus();
}
onload = focusIt;
</script>

What should I do to make it work with focus on it.

Please help, I am stuck on this for some time now.

Thanks Pat.
 
L

Larry Bud

Hi ASP Gurus,
Please help me.
Autocomplete works fine when the control does not have the focus when the
page load.
But when I put the focus on page load, then autocomplete does not work.
I even tried javascript pageload code, but with no success.
 <script language ="javascript" type ="text/javascript" >
            function focusIt() {
                //alert('test');
                var mytext =
document.getElementById('<%=txtSearch.ClientID%>');
                //alert(mytext);
                mytext.focus();
            }
            onload = focusIt;
</script>

What should I do to make it work with focus on it.

Please help, I am stuck on this for some time now.

Thanks Pat.


First off, you can just set the focus in server side code with

mycontrol.focus()

It generates the proper script for the focus to happen. But I don't
see how one thing affects the other.

What browser are you talking about? Autocomplete is completely a
browser function.
 
P

Pat

txtSearch.Focus() was the first thing I have tried. It did not work.
I am using IE7.

Pat

Hi ASP Gurus,
Please help me.
Autocomplete works fine when the control does not have the focus when the
page load.
But when I put the focus on page load, then autocomplete does not work.
I even tried javascript pageload code, but with no success.
<script language ="javascript" type ="text/javascript" >
function focusIt() {
//alert('test');
var mytext =
document.getElementById('<%=txtSearch.ClientID%>');
//alert(mytext);
mytext.focus();
}
onload = focusIt;
</script>

What should I do to make it work with focus on it.

Please help, I am stuck on this for some time now.

Thanks Pat.


First off, you can just set the focus in server side code with

mycontrol.focus()

It generates the proper script for the focus to happen. But I don't
see how one thing affects the other.

What browser are you talking about? Autocomplete is completely a
browser function.
 
L

Larry Bud

What didn't work? The focus, or the autocomplete?

Are you sure autocomplete isn't turned off in the browser?
 
P

Pat

Everything works if txtSearch does not have the focus when the page load.
It quit working the moment I put focus on that control at page load.
It works again if I comment that code.

Don't work means I do not see the dropdown.

Pat


What didn't work? The focus, or the autocomplete?

Are you sure autocomplete isn't turned off in the browser?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top