Home All Groups Group Topic Archive Search About
Author
26 Nov 2005 5:14 AM
Simon Cheng
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

Author
27 Nov 2005 1:41 AM
Steve C. Orr [MVP, MCSD]
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


Show quoteHide quote
"Simon Cheng" <simon_cheng***@hotmail.com> wrote in message
news:e0oPxgk8FHA.956@TK2MSFTNGP10.phx.gbl...
> 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
>
Author
27 Nov 2005 10:17 PM
Simon Cheng
Thanks! ASP.NET 2.0's DefaultButton only supports (well) Button control. Is
there an equivalent for TextBox control?

-Simon

Show quoteHide quote
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e%23rS8Ov8FHA.1000@tk2msftngp13.phx.gbl...
> 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" <simon_cheng***@hotmail.com> wrote in message
> news:e0oPxgk8FHA.956@TK2MSFTNGP10.phx.gbl...
>> 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
>>
>
>