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

Set focus on textbox

Hello,
How do i set focus on text box or any web control in my
aspx.vb page..pls help
Nov 18 '05 #1
4 1301
</form>
<script>
document.all.Button1.focus();
</script>
</body>
</html>

"Saifee" <sa*****@yahoo.com> ????
news:ee****************************@phx.gbl...
Hello,
How do i set focus on text box or any web control in my
aspx.vb page..pls help

Nov 18 '05 #2
thanx for the script worked fine, but then how do i set
the focus on a control in run time
say if the user do not enter a value in a textbox,
i dsiplay a message n then have to set the focus to the
textbox
-----Original Message-----
</form>
<script>
document.all.Button1.focus();
</script>
</body>
</html>

"Saifee" <sa*****@yahoo.com> ????
news:ee****************************@phx.gbl...
Hello,
How do i set focus on text box or any web control in my
aspx.vb page..pls help

.

Nov 18 '05 #3
Here is an example...

<html>
<body>
<form runat="server">
<asp:TextBox ID="TextBox1" RunAt="server" /><br>
<asp:TextBox ID="TextBox2" RunAt="server" /><br>
</form>
</body>
</html>

<script language="javascript">
document.forms[0].TextBox1.focus ();
</script>

Nov 18 '05 #4
<asp:placeholder id=script1 runat=server Visible=False
EnableViewState=False>
<script>
alert('please input something');
document.all.TextBox1.focus();
</script>
</asp:placeholder>
</form>

to enable the script once , using C#:

placeholder.Visible=true;
"Saifee" <sa*****@yahoo.com> ????
news:04****************************@phx.gbl...
thanx for the script worked fine, but then how do i set
the focus on a control in run time
say if the user do not enter a value in a textbox,
i dsiplay a message n then have to set the focus to the
textbox
-----Original Message-----
</form>
<script>
document.all.Button1.focus();
</script>
</body>
</html>

"Saifee" <sa*****@yahoo.com> ????
news:ee****************************@phx.gbl...
Hello,
How do i set focus on text box or any web control in my
aspx.vb page..pls help

.

Nov 18 '05 #5

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

Similar topics

17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
0
by: Miquel | last post by:
Hi all. I felt frustrated when developing an 'UserControl' derivated from textBox, because sequence event (and Validate event) seems to fail. I Always thought my code was wrong. But after...
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...
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...
5
by: Tosch | last post by:
I have a usercontrol with a label, a textbox, a treeview, a grid and a couple of checkboxes. The usercontrol is hosted on a form together with a cancel and a accept button. This form is used to...
3
by: vivela | last post by:
hi, I hope you could help me out on this one,cause I have been trying for 4 days to solve it,but couldn't quite get it right: I have an ASP textbox that should change the value in a dropdownlist....
3
by: Henry Jones | last post by:
VS 2005 On a form I have a tabcontrol with 5 tabs. Each tab has three textboxes on it. When I click on each tab, I would like to have the focus set to the first textbox. On the tabenter...
3
by: hugo | last post by:
Hi, I have a function that I call from form fields using the OnKeyUp function to replace special caracters. Once this function has been called, it does not set the focus on the form field where...
3
by: jp2express | last post by:
I have several applications that use panels as screens, but I can *not* seem to set the focus for a Textbox. Panel1.BringToFront() Panel1_Textbox.Focus() ' do something with a control on Panel1...
10
by: Derek Hart | last post by:
I can set focus to my property grid by using propgrid.Focus - but how can I set the default property that is always first? Or just set focus to the default property? Can this be done?
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.