User Control Focus Problem.....Plz. help
I have a user control on my asp.net page . This user control has 4 buttons on click of these buttons a new page opens below these user controls. Now after the page is opened and i click anwhere on the page the focus goes to 1st button in user control irrespective of the button i click. Hence when my user hits enter every time the first page opens. I have checked the code and there is no focus set for this in my code. I dont understand why it is happening. I wnt that when the user select a button the focus remains on it even if i click on the page.could some body help me.... I require it..........
[603 byte] By [
meerraj] at [2007-11-11 10:29:19]

# 1 Re: User Control Focus Problem.....Plz. help
This is more of HTML problem then .NET. It is probably your TabIndex. You just need to figure out a way to set the tab index: either by using the form or URL variables to keep track of which button was clicked and then set that one's tab index as 1. I could be wrong though but it seems like it's just that issue.
# 2 Re: User Control Focus Problem.....Plz. help
How are you opening the new page below the buttons? Are you using a JavaScript window.open? If so, you can add a line of JavaScript to set the focus to the button that was clicked. Or, rather than opening another browser window, you can use a <div> that appears to float over the main page; since the page never loses focus, the browser should not set the focus to a different button.
The bottom line is that focus is a client-side issue; you'll have to manage it with JavaScript in the browser. Kashif is correct that it really has nothing to do with .NET.