473,386 Members | 1,820 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,386 software developers and data experts.

Control refuses to get focus

1
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 1538
gits
5,390 Expert Mod 4TB
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
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...
2
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...
2
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
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...
1
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...
4
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...
9
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...
3
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...
3
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"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.