Web Control TextBox Selection during PreRender

  • Thread starter Thread starter Paul C.
  • Start date Start date
P

Paul C.

Hi folks. I have a WebControl TextBox which I would like to force to select
all it's text during PreRender. My problem is that I don't know how to do
this. I already have a reference to the control by using FindControl(), but
I don't see any method or property I can use to set the selection range. I
am looking for something like SelectionStart() and SelectionLength().

The WinForms TextBox has these methods, but the Web Forms does not. Any
ideas on how to do this?
 
Paul,

You can do it on client side. Handle body onload event and call select()
method for the <input type=text...> element representing the textbox.

Eliyahu
 
Eliyahu,

Thank you. I will try it this route.

Paul C.

Eliyahu Goldin said:
Paul,

You can do it on client side. Handle body onload event and call select()
method for the <input type=text...> element representing the textbox.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top