Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Text in ASP:textbox

Status
Not open for further replies.

tjherman

Programmer
Jun 19, 2006
68
US
I am using Visual Studio 2005 and writing all code-behind in VB. I'm setting the focus of a textbox after I run some calculations. I want to additionally select all the text in the textbox that I've set the focus to so that the user doesn't have to manually select the text and type. Can someone give me an example of how to do this programmatically?
 
You'll have to use javascript - see the "select" method or ask in the javascript forum for more info.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Use this:
Code:
<asp:TextBox ID="TextBox1" runat="server" Text="This is a text" onfocus="this.select();"></asp:TextBox>

Sharing the best from my side...

--Prashant--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top