473,320 Members | 2,097 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,320 software developers and data experts.

set focus bug problem

Hi,

private void SetFocus(Control ctrl) // SetFocus to a particular control
{
string focusScript = "<script language='javascript' id='FocusScript'> "
+
"document.getElementById('" + ctrl.ClientID +
"').focus();</script>";
Page.RegisterStartupScript("FocusScript", focusScript);
}

And in my ASP.Net C# Account.aspx.cs file in the page_load, I have
this.SetFocus(TextAccount).
But the focus just NOT set on the TextAccount control. The TextAccount is
an web form control.
Would someone tell me what's wrong?
Thanks!

Jason
Nov 17 '05 #1
1 2092
http://ryanfarley.com/blog/archive/2004/12/21/1325.aspx

"Jason Huang" <Ja************@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP10.phx.gbl...
Hi,

private void SetFocus(Control ctrl) // SetFocus to a particular control
{
string focusScript = "<script language='javascript' id='FocusScript'>
" +
"document.getElementById('" + ctrl.ClientID +
"').focus();</script>";
Page.RegisterStartupScript("FocusScript", focusScript);
}

And in my ASP.Net C# Account.aspx.cs file in the page_load, I have
this.SetFocus(TextAccount).
But the focus just NOT set on the TextAccount control. The TextAccount is
an web form control.
Would someone tell me what's wrong?
Thanks!

Jason

Nov 17 '05 #2

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

Similar topics

3
by: Dai Ba Wong | last post by:
Hi: Currently I am having a problem with my webpage. My page consist of two frames, one consist of input text field and the other contains link for different pop-up windows. The problem...
2
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...
2
by: Jesper | last post by:
Last week I posted this for the first time. However, I didn't get any useable solution to my problem. I'm very keen on getting this problem solved, so please excuse me for trying again. I'll try to...
1
by: avnrao | last post by:
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...
4
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...
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...
11
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...
7
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'...
3
by: jan.loucka | last post by:
Hi, I looked around for this specific problem but could not find any answer - there's few things in VB but still nothing exactly like this so I'd appreciate any help. We're writing C# WinForm...
2
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.