Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Setting focus to TextBox

Reply
Thread Tools

Setting focus to TextBox

 
 
Simon Cheng
Guest
Posts: n/a
 
      11-26-2005
Hi,,

Is there a way to set focus to an System.Web.UI.WebControls.TextBox control
on a web form? The class doesn't seem to provide such facility? Basically I
want to set input cursor to a TextBox when the page is first loaded or after
the user submit invalid data.

Thanks,
- Simon


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-27-2005
You can set focus to a particular control with the Javascript "focus"
method.

In ASP.NET 2.0 its even easier.

Here are all the details:
http://SteveOrr.net/faq/2in1.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Simon Cheng" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,,
>
> Is there a way to set focus to an System.Web.UI.WebControls.TextBox
> control on a web form? The class doesn't seem to provide such facility?
> Basically I want to set input cursor to a TextBox when the page is first
> loaded or after the user submit invalid data.
>
> Thanks,
> - Simon
>



 
Reply With Quote
 
 
 
 
Simon Cheng
Guest
Posts: n/a
 
      11-27-2005
Thanks! ASP.NET 2.0's DefaultButton only supports (well) Button control. Is
there an equivalent for TextBox control?

-Simon

"Steve C. Orr [MVP, MCSD]" <(E-Mail Removed)> wrote in message
news:e%(E-Mail Removed)...
> You can set focus to a particular control with the Javascript "focus"
> method.
>
> In ASP.NET 2.0 its even easier.
>
> Here are all the details:
> http://SteveOrr.net/faq/2in1.aspx
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> "Simon Cheng" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,,
>>
>> Is there a way to set focus to an System.Web.UI.WebControls.TextBox
>> control on a web form? The class doesn't seem to provide such facility?
>> Basically I want to set input cursor to a TextBox when the page is first
>> loaded or after the user submit invalid data.
>>
>> Thanks,
>> - Simon
>>

>
>



 
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