Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Setting focus on control

Reply
Thread Tools

Setting focus on control

 
 
Mike
Guest
Posts: n/a
 
      08-11-2004

Hi,

I have a webform with two textboxes and two buttons. I would like to set the focus to the first textbox when the page is displayed. I tried to change the TabIndex, but apparently, it does not have any effect. Any idea on how I could do that?

Thanks
Mike


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      08-11-2004
The easiest, most reliable way is client side Javascript:

MyControl.focus();

Here's more info:
http://wp.netscape.com/eng/mozilla/3..._f-g.htm#59872

You might also consider using this free control:
http://www.metabuilders.com/Tools/FirstFocus.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Mike" <> wrote in message news:...

Hi,

I have a webform with two textboxes and two buttons. I would like to set the focus to the first textbox when the page is displayed. I tried to change the TabIndex, but apparently, it does not have any effect. Any idea on how I could do that?

Thanks
Mike


 
Reply With Quote
 
 
 
 
=?Utf-8?B?c2VudGhpbA==?=
Guest
Posts: n/a
 
      08-11-2004
http://www.extremeexperts.com/Net/Co...rPostback.aspx

"Mike" wrote:

>
> Hi,
>
> I have a webform with two textboxes and two buttons. I would like to set the focus to the first textbox when the page is displayed. I tried to change the TabIndex, but apparently, it does not have any effect. Any idea on how I could do that?
>
> Thanks
> Mike
>
>

 
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
setting focus to a control within a datagrid Craig G ASP .Net 2 12-15-2004 06:12 PM
setting focus to an asp.net web user control =?Utf-8?B?Q0xFQVItUkNJQw==?= ASP .Net 12 12-07-2004 02:29 AM
Setting Focus on control after Validation Vinod I ASP .Net 2 02-04-2004 08:14 PM



Advertisments