473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

SetFocus

Hello, everyone...I am working on a web form and I am trying to set the focus
to a button when the cursor is placed in a certain textbox.

Can someone point me to the right direction?

Thanks
Aug 1 '06 #1
5 4441
http://www.ferrysoft.com/developmenthowtosetfocus.htm should help you out.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Antonio" <An*****@discussions.microsoft.comwrote in message
news:84**********************************@microsof t.com...
Hello, everyone...I am working on a web form and I am trying to set the
focus
to a button when the cursor is placed in a certain textbox.

Can someone point me to the right direction?

Thanks

Aug 1 '06 #2
Hi, Greg, thank you for your reply. I am however using C#

"Greg Young" wrote:
http://www.ferrysoft.com/developmenthowtosetfocus.htm should help you out.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Antonio" <An*****@discussions.microsoft.comwrote in message
news:84**********************************@microsof t.com...
Hello, everyone...I am working on a web form and I am trying to set the
focus
to a button when the cursor is placed in a certain textbox.

Can someone point me to the right direction?

Thanks


Aug 1 '06 #3
It is the exact same process (in fact the work isn't really being done in
VB.NET or C#)

the key thing to notice is that it is just using javascript (it uses
getElementById() then calls focus() on the item).

Cheers,

Greg
"Antonio" <An*****@discussions.microsoft.comwrote in message
news:F3**********************************@microsof t.com...
Hi, Greg, thank you for your reply. I am however using C#

"Greg Young" wrote:
>http://www.ferrysoft.com/developmenthowtosetfocus.htm should help you
out.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Antonio" <An*****@discussions.microsoft.comwrote in message
news:84**********************************@microso ft.com...
Hello, everyone...I am working on a web form and I am trying to set the
focus
to a button when the cursor is placed in a certain textbox.

Can someone point me to the right direction?

Thanks



Aug 1 '06 #4
Greg, I have no JavaScript experience and just started working on .NET.
Isn't there something easier? Something like it is used for Windows Forms
(GotFocus)?

"Greg Young" wrote:
It is the exact same process (in fact the work isn't really being done in
VB.NET or C#)

the key thing to notice is that it is just using javascript (it uses
getElementById() then calls focus() on the item).

Cheers,

Greg
"Antonio" <An*****@discussions.microsoft.comwrote in message
news:F3**********************************@microsof t.com...
Hi, Greg, thank you for your reply. I am however using C#

"Greg Young" wrote:
http://www.ferrysoft.com/developmenthowtosetfocus.htm should help you
out.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Antonio" <An*****@discussions.microsoft.comwrote in message
news:84**********************************@microsof t.com...
Hello, everyone...I am working on a web form and I am trying to set the
focus
to a button when the cursor is placed in a certain textbox.

Can someone point me to the right direction?

Thanks


Aug 1 '06 #5
No .. It would require a postback .. remember you do not have a persistent
connection (the code that handles this needs to be run in the browser not on
the server).

Writing a javascript function to do this is quite simple though.

document.forms[0].youritem.focus();

Remember that ASP.NET mangles names so you will want clientid from the
server side.

Cheers,

Greg
"Antonio" <An*****@discussions.microsoft.comwrote in message
news:F7**********************************@microsof t.com...
Greg, I have no JavaScript experience and just started working on .NET.
Isn't there something easier? Something like it is used for Windows Forms
(GotFocus)?

"Greg Young" wrote:
>It is the exact same process (in fact the work isn't really being done in
VB.NET or C#)

the key thing to notice is that it is just using javascript (it uses
getElementById() then calls focus() on the item).

Cheers,

Greg
"Antonio" <An*****@discussions.microsoft.comwrote in message
news:F3**********************************@microso ft.com...
Hi, Greg, thank you for your reply. I am however using C#

"Greg Young" wrote:

http://www.ferrysoft.com/developmenthowtosetfocus.htm should help you
out.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Antonio" <An*****@discussions.microsoft.comwrote in message
news:84**********************************@microso ft.com...
Hello, everyone...I am working on a web form and I am trying to set
the
focus
to a button when the cursor is placed in a certain textbox.

Can someone point me to the right direction?

Thanks



Aug 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: amy | last post by:
I have a text box, after user input the value, a validate function trigered. if the value is invalid, alert display, and also set focus back to this control. The alert displays, but when the...
4
by: Mad Scientist Jr | last post by:
i am trying to set focus to a specific control depending on the outcome of a validator control and it is not working. none of these methods are working to setfocus: 1....
8
by: Shachar | last post by:
Hi All, I need to start a new process calc for example and when ever the user click on the button the application should setfocus to the calc application. I use this code but it is NOT...
0
by: MrsLeigh | last post by:
I have a datagrid on a web page. In the footer there is a field that should be recieve the focus, either at the start or after a button is clicked to insert the row that is being added in the...
3
by: Jim Devenish | last post by:
In my application vehicles arrive and depart from a workshop. The ArrivalDate and the HandoverDate are each entered. Sometimes the person who should enter the arrival date forgets to do so. ...
12
by: Michael R | last post by:
TabCtrl --- ..............Tab1--Subform1 ..............Tab2--Subform2---TabCtrl2---Tab21 ..........................................................---Tab22...
0
by: srinivasarao yarru | last post by:
hi sir, in access 2003 how we can use the setfocuse property(we have to lostfocuse from one field with in that we have to setfocuse in same field) i am using this code but not setfocuse...
3
by: srinivasarao yarru | last post by:
hi in access 2003 how we can use the setfocuse property(we have to lostfocuse from one field with in that we have to setfocuse in same field) i am using this code but not setfocuse to same field...
5
agroover
by: agroover | last post by:
I can't seem to figure out how to get rid of the errors. I recieve the following error when I leave the Grade.SetFocus in my code... Microsoft Access can't move the focus to the control Grade ...
3
by: ckrows | last post by:
I have a main form with a button that makes a subform visible. I added a button in the form footer of the subform that is supposed to hide the subform. This does not work because the focus is on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.