473,480 Members | 2,840 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to select the text in a TextBox

ad
I have a Textbox (Text) in a web form.
I use
this.SetFocus(Text1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?
Feb 5 '06 #1
5 2311
You can do it on client side with a javascript call myTextBox.select();

Eliyahu

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eb*************@tk2msftngp13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(Text1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?

Feb 5 '06 #2
ad
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re*************@monarchmed.com> ¼¶¼g©ó¶l¥ó·s»D:Od*************@TK2MSFTNGP15.phx.gb l...
You can do it on client side with a javascript call myTextBox.select();

Eliyahu

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eb*************@tk2msftngp13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(Text1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?


Feb 5 '06 #3
ad
I use:

myTextBox.Attributes["onfocus"] = myTextBox.ClientID + ".sclect();";

But it can't work.

"ad" <fl****@wfes.tcc.edu.tw> ¼¶¼g©ó¶l¥ó·s»D:eb**************@TK2MSFTNGP09.phx.g bl...
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re*************@monarchmed.com> ¼¶¼g©ó¶l¥ó·s»D:Od*************@TK2MSFTNGP15.phx.gb l...
You can do it on client side with a javascript call myTextBox.select();

Eliyahu

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eb*************@tk2msftngp13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(Text1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?



Feb 5 '06 #4
When do you want the textbox to get focus and become selected? When the page
loads? When a button is clicked?

Eliyahu

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eb**************@TK2MSFTNGP09.phx.gbl...
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re*************@monarchmed.com>
¼¶¼g©ó¶l¥ó·s»D:Od*************@TK2MSFTNGP15.phx.gb l...
You can do it on client side with a javascript call myTextBox.select();

Eliyahu

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eb*************@tk2msftngp13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(Text1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?



Feb 5 '06 #5
ok, you can take this way. Just try

myTextBox.Attributes["onfocus"] = "this.select();";

Eliyahu
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eh**************@TK2MSFTNGP15.phx.gbl...
I use:

myTextBox.Attributes["onfocus"] = myTextBox.ClientID +
".sclect();";

But it can't work.

"ad" <fl****@wfes.tcc.edu.tw>
¼¶¼g©ó¶l¥ó·s»D:eb**************@TK2MSFTNGP09.phx.g bl...
Thanks,
But I can't do.
Please give me some code.

"Eliyahu Goldin" <re*************@monarchmed.com>
¼¶¼g©ó¶l¥ó·s»D:Od*************@TK2MSFTNGP15.phx.gb l...
You can do it on client side with a javascript call myTextBox.select();

Eliyahu

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eb*************@tk2msftngp13.phx.gbl...
I have a Textbox (Text) in a web form.
I use
this.SetFocus(Text1);

to set the focus on Text1.
How can I let the text in Text1 selected when the Text1 get focus?



Feb 5 '06 #6

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

Similar topics

3
21687
by: Phill | last post by:
I thought when you tabbed into a textbox that the text it contained was automatically highlighted. This use to be the default in win32. Is there an easy way to do this in .NET. I don't want this...
1
2059
by: Mad Scientist Jr | last post by:
I'm stuck trying to work with a HTML <SELECT> control and javascript (similar to DualList but that control doesn't offer enough options to totally control the text on the buttons and control, also...
2
4317
by: Cindy M -WordMVP- | last post by:
Hi all While working my way through a VB.NET exercise, I came across something that didn't do what the text said it should and I'm wondering if it's supposed to behave this way, or not (and...
4
5410
by: Brett | last post by:
I have a textbox with a heigth of 384. I put a lot of text into it and must scroll down to see it all. When I do Ctrl + A, it doesn't highlight all of the text. I have to manually drag my mouse...
3
30070
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me...
8
21852
by: cj | last post by:
I asked this question a couple of days ago but am just now looking at it again. I used to use the textbox gotfoucs event to have all the text in the textbox selected when it gotfocus. That...
4
8656
by: Dabbler | last post by:
Is there a way to mark the text in a TextBox control as selected so when the user types a new value the existing text is replaced? Thanks
12
2132
by: Brano | last post by:
Hi I am using vb.net 2005 this is a windows application I am using this functionality in another project I have created this simple project to show the problem Basically I have two forms: ...
13
5762
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7060
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
7106
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...
1
4799
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...
0
4501
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3013
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.