btnNext always gets focus

  • Thread starter Thread starter DalePres
  • Start date Start date
D

DalePres

I suppose it might really be an IE problem but since I'm developing in C#
and .Net, I'm asking here.

I have an app with a couple pages that each have a button Web Server control
named btnNext. To see the button, the user has to scroll down once from the
top of the screen...or should have to. Adjacent on the page to the btnNext
button is another identical button: btnCancel.

The problem I was having is that whenever the page loaded, it automatically
scrolled down to show the btnNext button. If I disabled or deleted the
button, the page would show the top of the page on load, as desired, rather
than scrolling down. I even tried deleting btnNext and making a new one by
copying btnCancel. Same problem. btnCancel alone didn't cause the scroll.
btnNext still caused the scroll but only after I changed the name from the
default of Button1 to btnNext. What is weird that if I rename btnNext to
anything except btnNext, the problem goes away. It is the name and the
name alone that is causing the problem.

Has anyone else run across this?

Dale
 
Thanks for the reply but I understand how to set the focus. What I am
trying to understand is why I need to in this case. And why just the name
of the control will make IE set the focus to it. Weird stuff.

Dale
 
Back
Top