Solved

how to highlight text in textbox when in focus in

Posted on 2009-07-07
4
803 Views
Last Modified: 2012-05-07
I have a webform with textboxes if a user clicks on the textbox I want all the text in the textbox to be selected (highlighted)
0
Comment
Question by:mugsey
  • 3
4 Comments
 
LVL 15

Accepted Solution

by:
crisco96 earned 300 total points
ID: 24793105
<asp:textbox runat="server" text="Some Text" onfocus="this.select()" />
0
 
LVL 7

Assisted Solution

by:Valleriani
Valleriani earned 200 total points
ID: 24793115
If you are looking to highlight text in a textbox then you can do:

TextBox1.Attributes.Add("onFocus", "JavaScript:this.select();") for example!
0
 
LVL 7

Assisted Solution

by:Valleriani
Valleriani earned 200 total points
ID: 24793136
If it's using for example a inputbox, you could also just use:

<input type="text" name="test" onclick='this.select();'/>
0
 
LVL 7

Expert Comment

by:Valleriani
ID: 24793138
Oh my bad crisco96 already stated it above ;)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question