setfocus and select text in a textbox

setfocus and select text in a textbox

Post by QW5kcmV » Thu, 13 Apr 2006 19:30:02


hi all,

I have a webform that I would like do add some features.
How do I :
1) setfocus in a textbox when the page first loads up; and also dynamically
when I want to focus on it.
2) highlight the text in a textbox.

TIA.
regards,
andrew
 
 
 

setfocus and select text in a textbox

Post by Y2xpY2tvb » Thu, 13 Apr 2006 19:55:02

I don't know how to highlight the text in a text box but to set the focus on
it you just call the focus method. e.g. MyTextBox.Focus();

 
 
 

setfocus and select text in a textbox

Post by QW5kcmV » Thu, 13 Apr 2006 20:10:02

i am refering to a webform on asp.net 1.1. I don't think there is a focus()
for a textbox server control.
 
 
 

setfocus and select text in a textbox

Post by Y2xpY2tvb » Thu, 13 Apr 2006 20:19:02

oh right, there is in ASP.net 2.0, i didn't realise it was a new method.
 
 
 

setfocus and select text in a textbox

Post by QW5kcmV » Thu, 13 Apr 2006 23:58:02

anyone else able to assist me. all suggestions are welcomed.