Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > setting focus to textbox

Reply
Thread Tools

setting focus to textbox

 
 
Tony Piperato
Guest
Posts: n/a
 
      10-23-2003
Hello,

Can someone tell me if/how I can set the focus to a textbox so when the page
loads the cursor is placed in the textbox and the user can just begin
typing?

Thanks.

Pip


 
Reply With Quote
 
 
 
 
Victor Garcia Aprea [MVP]
Guest
Posts: n/a
 
      10-23-2003
Hi Tony,

Its pretty simple, you just need to output some javascript from the
server-side to set the focus to the control you want, take a look at
javascript's focus function. If I remember right, ScottGu[1] has posted a
ppt with some tricks & tips (including the focus one).

[1] http://weblogs.asp.net/scottgu

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx

To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

and not by private mail.
"Tony Piperato" <(E-Mail Removed)> wrote in message
news:u%(E-Mail Removed)...
> Hello,
>
> Can someone tell me if/how I can set the focus to a textbox so when the

page
> loads the cursor is placed in the textbox and the user can just begin
> typing?
>
> Thanks.
>
> Pip
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
emulating window.focus in Body onload() event and setting focus to a control on same page Jason ASP .Net 4 05-07-2007 05:54 PM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
Why does putting focus on textbox also set focus to submit jw56578@gmail.com Javascript 2 06-06-2005 08:20 PM
setting focus to a textbox test test ASP .Net 1 08-30-2003 06:33 PM
Setting Focus on an asp:textbox George Durzi ASP .Net 4 08-20-2003 05:42 PM



Advertisments