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

Setting Focus on a TextBox Control

How do I set the focus on a TextBox control when a web
page loads.

Thanks,

Dave
Nov 15 '05 #1
3 1681
Dave,

There is a load event on the body tag which you can use to set the focus
of the textbox. However, you have to do this in JavaScript, not in C#.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
How do I set the focus on a TextBox control when a web
page loads.

Thanks,

Dave

Nov 15 '05 #2
in the <body .. > tag
add something like
<body ... onload=thiscontrol.focus() >
-----Original Message-----
How do I set the focus on a TextBox control when a web
page loads.

Thanks,

Dave
.

Nov 15 '05 #3
in the <body .. > tag
add something like
<body ... onload=thiscontrol.focus() >
-----Original Message-----
How do I set the focus on a TextBox control when a web
page loads.

Thanks,

Dave
.

Nov 15 '05 #4

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

Similar topics

3
by: Jesper Dannemamm | last post by:
Hi I am having trouble setting focus on I tried using this script in the usercontrol's page_load sub to set focus on a textbox with the ID = "user_name": Page.RegisterStartupScript("focus",...
2
by: Mystery Man | last post by:
We have an MDI application that is not setting always setting focus to the newly corrected MDI. It is creating the form and it is the topmost but it does not have focus. The code we are using to...
2
by: Jesper | last post by:
Hi, I'm showing a usercontrol containing a textbox on the screen by clicking a notifyIcon in the taskpane. I use textBox.Focus() to set the focus for the texbox, and I also get a blinking...
2
by: Vinod I | last post by:
Hi Team, I am using validator controls. Please let me know how to set the focus back to the control after validation. Thanks in advance... cheeeeeeeeers!!!
2
by: Mike | last post by:
Hi, I have a webform with two textboxes and two buttons. I would like to set the focus to the first textbox when the page is displayed. I tried to change the TabIndex, but apparently, it does not...
12
by: CLEAR-RCIC | last post by:
Hi, I'm having problems setting focus to a textbox on a web user contol on an asp.net web page. The following script works on normal asp.net pages: <script language="javascript"> function...
1
by: reidarT | last post by:
I have a webform and found some code where I understand some of it, but not all The code is as follows public static void SetFocus(Control control) { StringBuilder sb = new StringBuilder(); ...
1
by: Praveena.Alapati | last post by:
Hi, There is a tab control on a page with multiple tabs and handful of controls in each tab. The way it's rendered in html (like grid etc..) is in table format in tablerows and cells. On...
3
by: bcwatson | last post by:
My Access DB has a main data entry form. There are so many fields on the form that I've added a vertical scroll bar. When my cursor is in a text box near the bottom of the form and click on the...
3
by: kelvin.koogan | last post by:
I have a number of controls on a tab page. I want to validate them all when the user tries to leave the tab. I then want to highlight the first control which fails validation. How can I do this? I...
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...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
1
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...
1
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....

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.