Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 dont want focus

Author  Topic 

jhermiz

3564 Posts

Posted - 2005-01-12 : 17:13:30
I have an image button on a header page which I have set for the tab index -1 hoping it NEVER receives the focus because it is a log out button. Apparently that doesnt help...whenever I hit enter anywhere on the page, it logs me out of the system because it seems to still have the focus. I have tried everything including a setfocus event that i have:


Private Sub SetFocus(ByVal ctrl As Control)

' Define a JavaScript statement that will move focus to
' the desired control.
Dim SetFocus As String = "<script language='javascript'>" & _
"document.getElementById(""" & ctrl.ClientID & _
""").focus();</script>"

' Add the JavaScript code to the page.
ctrl.Page.RegisterStartupScript("SetFocus", SetFocus)

End Sub


And when I try to do:

SetFocus(Me.txtBox)

Its fine it sets the text box BUT if i hit enter it still logs me out of the system...seems like this button always has the focus.

Isnt there any way to turn it off!!!

Thanks,
Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]


MichaelP
Jedi Yak

2489 Posts

Posted - 2005-01-12 : 17:23:54
I think that's one "feature" of IE. You could be sneaky and add an invisible (using CSS) html button that does nothing before the image button.

Michael



<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-12 : 17:30:10
ya that might be my only route, i was hoping to avoid that, but I would think .net had a mechanism...nevermind Im not even gonna bother thinking about it. I'll add an html button and set it to invisible and have it do nothing.

THanks,
Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]


Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-01-12 : 17:31:08
It's more of an IE thing than an HTML or .Net Thing.

Michael



<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-12 : 17:32:37
Alrighty...

I'll just add the button, set it to invisible, grab my keys head out the door and grab a pizza :) I'm outtie!!

Thanks!!!




Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]


Go to Top of Page

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2005-01-12 : 17:34:31
Perhaps you could add a javascript onclick event handler to the image button that would return false whenever it is clicked.

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-01-12 : 17:51:40
Dustin, that's not going to work becuase he wants it to log them out when they click, just not when they hit "enter."

Jon, I believe that you need to make the hidden HTML button a SUBMIT button.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-12 : 18:59:28
quote:
Originally posted by MichaelP

Dustin, that's not going to work becuase he wants it to log them out when they click, just not when they hit "enter."

Jon, I believe that you need to make the hidden HTML button a SUBMIT button.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>



I believe Mike is right, still need to be able to log out :).
Mike, I'll try this tomorrow.

Thanks again,
Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]


Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2005-01-13 : 12:03:51
This should help:

http://www.allasp.net/enterkey.aspx

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page
   

- Advertisement -