473,782 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control refuses to get focus

1 New Member
Hello all,
I have a few '<input type="text" />' controls on my ASP.NET 2.0 generated page.
Every text-box control has it's specific tab-index.
When I try to move focus to this specific text-box control on this page the focus is shifted to the window element instead of the control itself.
On every other text-box control on the page the focus is received fine.
To apply focus to this element I use the code:
Expand|Select|Wrap|Line Numbers
  1. document.all.elemName.focus();
This is the control itself:
Expand|Select|Wrap|Line Numbers
  1.     <input name       = "ctl00$EditMasterContent$c_carats"
  2.            type       = "text"
  3.            maxlength  = "10"
  4.            id         = "ctl00_EditMasterContent_c_carats"
  5.            tabindex   = "6"
  6.            class      = "textbox1"
  7.            onchange   = "registerOnChangeAction(&quot;caratsChanged&quot;);"
  8.            onkeypress = "javascript:ChkNumberKeyPress(false);"
  9.            onfocus    = "initFocusedElementsVar(this.id);"
  10.            style      = "width: 100px;" />
  11.  
Some other text-box control on the page:
Expand|Select|Wrap|Line Numbers
  1.     <input name       = "ctl00$EditMasterContent$c_stones"
  2.            type       = "text"
  3.            maxlength  = "5"
  4.            id         = "ctl00_EditMasterContent_c_stones"
  5.            tabindex   = "5"
  6.            class      = "textbox1"
  7.            onchange   = "registerOnChangeAction(&quot;stonesChanged&quot;);"
  8.            onkeypress = "javascript:ChkNumberKeyPress(false);"
  9.            onfocus    = "initFocusedElementsVar(this.id);"
  10.            style      = "width: 100px;" />
  11.  
Feb 4 '08 #1
1 1553
gits
5,390 Recognized Expert Moderator Expert
hi ...

when do you try to set the focus ... onload of the page? could you post an example code that shows the 'flow' of instructions? :)

kind regards
Feb 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
3974
by: fotzor | last post by:
Hi, I'm a C++-Programmer and want to subclass the Edit used to write a SQL-Query in Access. The edit is of the special Access class OKttbx. Everything works, I injected a DLL into the Access-Process and the subclassing works but I can't get the Windowtext of the control...I tried the WM_GETTEXT message but it seems that Microsoft uses another way to get the text the user typed in. Has somebody an idea how I can get this to work? mfg...
2
2670
by: Lyn | last post by:
Hi, I have a text control on a form which is bound to table field StartDate which is in Date format. When updating the table record via the form, any data entered into the StartDate control is immediately validated. If the data entered is considered valid, focus moves to the next control in the tab sequence. So far, so good. If the data entered in StartDate is considered invalid, an error message is displayed via MsgBox. When OK is...
2
2157
by: bill | last post by:
I have the following user control in my project simply for setting focus to a control: Public Class SetFocus Inherits System.Web.UI.UserControl
2
8376
by: Tom | last post by:
I am developing a VB.NET user control that is composed of a component control (along with some classes, etc). This is probably a stupid question, and should be easy, but I must be having a brain fart. In the control itself, how do I set focus BACK to the form that the control is on? This control does some maniuplation of an outside application (by starting up the application and sending it keystrokes). What I want to be able to do is to...
1
5138
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
4
4306
by: Jon Slaughter | last post by:
I've created some custom controls and forms that allow the feature to temporarily transfer focus to a control that has been entered by the mouse. Everything seems to work fine but the problem I have is that sometimes I seem to loose the original "holder" of focus and when the user hits tab while using "temporary" focus(while the mouse is over a control) it will change focus to the next control but not update it. So I have several issues....
9
18022
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/system.windows.forms.control.focus(VS.80).aspx this page says: "Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms." I am trying to give a Numeric UpDown control focus. Only Focus() works. But this says to not use it.
3
2141
by: Nathan Laff | last post by:
I have a custom Control that is a label, however I inherit from Control... 1) I override onClick and do a DrawFocusRectangle, that works great. How do I clear the focus rectangle once something else on the parent is clicked? I tried to override OnLostFocus and invalidate but that doesn't seem to do it. 2) the control, like i said is a label, how do i override the hotkey behavior. I.e, if my text is &Help, when I do Alt-H on the parent,...
3
7045
by: Simon | last post by:
Dear reader, On the event "Lost focus" I make the ComboBox invisible but the massage pops up "You can't hide a control that has the focus." But this code is written in the "Lost focus" event so the combobox has not longer the focus regarding this event.
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.