?
Solved

How to unfocus

Posted on 2004-04-04
4
Medium Priority
?
345 Views
Last Modified: 2008-02-01
Is it possible to unfocus so that none of interactive controls are focused? Maybe focus on page or label?

Thanks.
0
Comment
Question by:gromul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 28

Assisted Solution

by:mmarinov
mmarinov earned 400 total points
ID: 10755313
you can use javascript and blur() method of the control
From MSDN:
blur Method

--------------------------------------------------------------------------------

Causes the element to lose focus and fires the onblur event.

HTH
B..G
0
 
LVL 29

Assisted Solution

by:David H.H.Lee
David H.H.Lee earned 400 total points
ID: 10756717
gromul,
>>Is it possible to unfocus so that none of interactive controls are focused? Maybe focus on page or label?
-You can set the focus into a hidden object. I think this method is quite simple as you wish to solve your problem.
eg:
<input type="hidden" name="focusItem" id="focusItem"/>
0
 
LVL 7

Accepted Solution

by:
dante469 earned 1200 total points
ID: 10758423
gromul,

Can't set focus to an ASP:Label because it renders as a <Span> and that is not able to accept focus.  Also the address bar and menu bars are not java accessible due to brower security :(...  Looked for a generic solution using built in components, but no great solution...

Either could convert one of your labels to a read/only text box...  Advantage can set focus, disadvantage will become part of the tab sequence...

x_com idea of creating an html: hidden control seems to be on the right track...  Please remember this needs to be an html:control b/c if you take and ASP: control and set visibility=False then the control is never rendered to the browser.

Codebehind to set focus:
Sub setfocus(ByVal ctrl As String)
        'Please remember JavaScript objects are case sensitive
        Dim sJava As String = "<script language='Javascript'>document.Form1." & ctrl & ".focus(); </script>"
        RegisterStartupScript("setfocus", sJava)
End Sub

Call this from your event:
setfocus("hiddenfocus")

hidden control in .aspx page:
<input type="hidden" name="hiddenfocus" />

Have Fun,
Dante
0
 

Author Comment

by:gromul
ID: 10762110
Thanks guys.
0

Featured Post

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question