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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting focus to text in a TextBox control

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
Hi all

I have an .aspx page with a textbox webform control. Basically what I want to do is - if the user enters an incorrect user name and password, I want to be able to inform them and set focus back to the incorrect item - with the incorrect text selected. The informing is not a problem - I just don't know how to select the text and set focus back to the text box. Is there any property or method I can use to do this?

Thanks as always

Craftor :cool:
 
Is it as simple as using .Focus() for the TextBox in question.
Hope that this helps.
Steve
 
No unfortunately not :-(

It's a web forms text box (in ASP .NET in case I was a bit unclear) so that method is not exposed.

I know it can be done in JavaScript - but I'd specifically like to do it in my C# code to cater for the specific scenarios mentioned above.

Thanks anyway! ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top