Search:
Namespaces
Discussions
.NET v1.1
Feedback
Setting Focus
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngclient' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Nash Mash
-- Moved from [ngfx-sqlclient] to [aspngclient] by Tim Musschoot <
Click here to reveal e-mail address
> --
How do I set a focus to an asp.net textbox
I am running a sub on change of a dropdown menu. After the sub finishes the
process I need to set the focus to another textbox, immediately.
I do not have any idea on how to set focus to a textbox
Any help please
Nash
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
Reply to this message...
Douglas Reilly (VIP)
Use Javascript. When you say you are "running a sub on change of a dropdown
box" is that a server side routine? You need to find a place to execute
<controlname>.focus(); in JavaScript when you return from the server-side
routine. You could add it to the OnLoad event of the <Body> when the
dropdown menu changes.
Doug Reilly
Designing Microsoft(r) ASP.NET Applications
http://www.programmingasp.net
----- Original Message -----
From: "Nash Mash" <
Click here to reveal e-mail address
>
To: "aspngclient" <
Click here to reveal e-mail address
>
Sent: Friday, July 19, 2002 7:23 AM
Subject: [aspngclient] Setting Focus
> -- Moved from [ngfx-sqlclient] to [aspngclient] by Tim Musschoot
<
Click here to reveal e-mail address
> --
[Original message clipped]
Reply to this message...
Nash Mash
I am doing some calculation and adding informtion to the database
Sub GetRateBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
Page
.Validate
If
Page
.IsValid = True Then
If title_id.SelectedItem.Value <> "Select a Title" Then
BindDataSizeRate()
End If
End Sub
Just as this sub is over I need to set focus to the textbox "pub_pos" just
next to it. Since its reloads the page I do not have focus anywhere. Also I
do not want to use it on Body onload, becuase I am using a template and I
cannot change the body tag.
Please can you help me out
Thanx
[Original message clipped]
_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Reply to this message...
Matt Serdar
here's a way
watch for URL wrapping
<
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html
/frlrfSystemWebUIPageClassRegisterClientScriptBlockTopic.asp>
hth
matt
-----Original Message-----
From: Nash Mash [mailto:
Click here to reveal e-mail address
]
Sent: Friday, July 19, 2002 12:31 PM
To: aspngclient
Subject: [aspngclient] Re: Setting Focus
I am doing some calculation and adding informtion to the database
Sub GetRateBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
Page
.Validate
If
Page
.IsValid = True Then
If title_id.SelectedItem.Value <> "Select a Title" Then
BindDataSizeRate()
End If
End Sub
Just as this sub is over I need to set focus to the textbox "pub_pos" just
next to it. Since its reloads the page I do not have focus anywhere. Also I
do not want to use it on Body onload, becuase I am using a template and I
cannot change the body tag.
Please can you help me out
Thanx
[Original message clipped]
_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com
| [aspngclient] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/aspngclient.asp
= JOIN/QUIT
Reply to this message...
Robm
If you need to set focus dynamically when the page reloads to different =
controls depending on the users selection, you can place a <asp:literal =
tag within the head of the page. Then within your onclick event method, =
you can set this literal tag to some javascript to focus on the control =
you want to have focus next.
eg:=20
Literal1.Text =3D "<script language=3D\"javascript\"> \n" +=20
"<!-- \n" +=20
"document.Template.SearchBtn.setActive()" =
+
"} \n" +=20
"//--> \n" +=20
"</script> \n";
=20
HTH,
Robert Merriott
>>>
Click here to reveal e-mail address
07/19/02 12:30PM >>>
I am doing some calculation and adding informtion to the database
Sub GetRateBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
Page
.Validate
If
Page
.IsValid =3D True Then
If title_id.SelectedItem.Value <> "Select a Title" Then
BindDataSizeRate()
End If
End Sub
Just as this sub is over I need to set focus to the textbox "pub_pos" just =
=20
next to it. Since its reloads the page I do not have focus anywhere. Also =
I =20
do not want to use it on Body onload, becuase I am using a template and =
I=20
cannot change the body tag.
Please can you help me out
Thanx
[Original message clipped]
_________________________________________________________________
Join the world=C6s largest e-mail service with MSN Hotmail.=20
http://www.hotmail.com=20
| [aspngclient] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.aspfriends.com/aspfriends/aspngclient.asp
=3D JOIN/QUIT
Reply to this message...
System.EventArgs
System.Web.UI.Page
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com