473,737 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.Focus problem..urgent ..

Hi,

I am facing a problem with control.focus (javascript). Here is the
description of the issue.

1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on
this, will redirect page to Aspx2 which has a Datagrid. PageLoad of Aspx2
displays the DataGrid with existing data filled in and shows a new row (set
of text boxes) in the Footer Item.
Now, when I set the focus by accessing the first text box in the Footer
Item, focus is not set. Moreover, I am unable to set the focus to that
textbox using mouse.
The textbox is not disabled. I am able to set the focus with mouse when just
use a tab.

When I remove the .focus code from pageload, thought I focus is not set, but
I am able to set focus using mouse for the first time.

Basically what I found out is, when I set the focus onto text box, the focus
has gone to IE menus (File,edit ects..). This is because when pageloads, I
just typed F, it opened File menu in the IE. I am not sure why its behaving
this way.

One more information, when I tried a repro of same problem using another set
of 2 aspx files to check if the issue is coming up there. To my surprise,
the focus is set properly.

I am setting the focus using the following line.
document.getEle mentById('dgCam paign').rows[document.getEle mentById('dgCam paign').rows.le ngth-1].cells[0].children[0].focus();

when I alert object id, or innerText, I get the proper values.

How to resolve this issue?? Please do reply if you need any more
information.

thank you,
Av.
Nov 18 '05 #1
1 2242
Hi

Works fine here.. will focus on first element in first cell on last row in
table

<html>
<head>
<script>
function doIt(){
var e = document.getEle mentById("myTab le");
if(e!=null)
{
var o = e.rows[e.rows.length-1].cells[0].children[0];
if(o!= null) o.focus();
}
}
</script>
</head>
<body onload="doIt()" >
<form>
<table id="myTable">
<tr><td><inpu t type="text"></td><td><input type="text"></td></tr>
<tr><td><inpu t type="text"></td><td><input type="text"></td></tr>
<tr><td><inpu t type="text"></td><td><input type="text"></td></tr>
</table>
</form>
</body>
</html>

--
Best Regards
Vidar Petursson
=============== ===============
Microsoft Visual: Scripting MVP 2000-2004
http://www.icysoft.com/
http://www.deus-x.com/ Instant e-commerce
http://www.microsoft.com/technet/scriptcenter/
Playground: http://213.190.104.211/ ( IE 5.5+ only )

No matter where you go there you are
=============== ===============
"avnrao" <av*@newsgroups .com> wrote in message
news:eI******** *****@tk2msftng p13.phx.gbl...
Hi,

I am facing a problem with control.focus (javascript). Here is the
description of the issue.

1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on
this, will redirect page to Aspx2 which has a Datagrid. PageLoad of Aspx2
displays the DataGrid with existing data filled in and shows a new row
(set of text boxes) in the Footer Item.
Now, when I set the focus by accessing the first text box in the Footer
Item, focus is not set. Moreover, I am unable to set the focus to that
textbox using mouse.
The textbox is not disabled. I am able to set the focus with mouse when
just use a tab.

When I remove the .focus code from pageload, thought I focus is not set,
but I am able to set focus using mouse for the first time.

Basically what I found out is, when I set the focus onto text box, the
focus has gone to IE menus (File,edit ects..). This is because when
pageloads, I just typed F, it opened File menu in the IE. I am not sure
why its behaving this way.

One more information, when I tried a repro of same problem using another
set of 2 aspx files to check if the issue is coming up there. To my
surprise, the focus is set properly.

I am setting the focus using the following line.
document.getEle mentById('dgCam paign').rows[document.getEle mentById('dgCam paign').rows.le ngth-1].cells[0].children[0].focus();

when I alert object id, or innerText, I get the proper values.

How to resolve this issue?? Please do reply if you need any more
information.

thank you,
Av.

Nov 18 '05 #2

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

Similar topics

2
3109
by: Peter Wright | last post by:
Hi all. Hopefully this should demonstrate the problem I'm having: http://flooble.net/~pete/focus-problem-demo/ (I'm testing it in Mozilla only, but I'm not sure if it's actually a Mozilla-only problem) I'm capturing the focus and blur events for the document, updating a
4
3949
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several textboxes and a checkbox. The behaviour I want from my app is as follows:- When the textbox (which is prior in tab order to the tab control) has been filled with a certain length of text by the user, the focus is
1
5135
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";
11
7343
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz 1.7.12 (linux kubuntu). It does work with konqueror. It seems to work with firefox on windows but not with IE (not completly sure though).
7
11926
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click' and it steals the focus from the user's current application. How can I prevent the hidden WebBrowser from stealing focus? (And better yet can I even suppress that click?_
6
5723
by: MSDN | last post by:
After a postback, how do I set focus onto a control that is inside an updatepanel?
2
6304
by: J055 | last post by:
Hi The client script does not get created when calling the Focus method on the TextBox. No errors occur. What am I doing wrong please? protected void fv_Load(object sender, EventArgs e) { FormView fv = (FormView)sender; TextBox tbFirstName = (TextBox)fv.FindControl("tbFirstName"); tbFirstName.Focus();
2
1994
by: Wingot | last post by:
Hey, I have a view to a database that I have created for Client Maintenance. It has a number of fields, but the important ones are Medical Condition, Bill To, and Country. I have a couple of external tables: One for Countries that store each Country as a ID (char(2)), and Name (varchar(50)) pair; One for Medical Conditions, using ID (int) and Name (varchar(50)). Also, the BillTo field refers back to the same table that is being...
6
1666
samikhan83
by: samikhan83 | last post by:
i am using focus() function of javascript it works great in FireFox but does blunder's in IE is there any problem of focus() in IE .... OR some fix OR.. some other method for IE... Please Reply Fast... URGENT..
0
8966
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
9467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9331
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
9257
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
8203
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
6749
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
6052
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.