Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Setting focus to a textbox

Reply
Thread Tools

Setting focus to a textbox

 
 
Nick S
Guest
Posts: n/a
 
      11-21-2005
When I validate data in a field, the form does a postback - and focus goes
back to the first control. How do I change focus to a different textbox. I
though texbox.focus or textbox.setfocus - but neither of these work...

Thanks


 
Reply With Quote
 
 
 
 
Rob Meade
Guest
Posts: n/a
 
      11-21-2005
"Nick S" wrote ...

> When I validate data in a field, the form does a postback - and focus goes
> back to the first control. How do I change focus to a different textbox. I
> though texbox.focus or textbox.setfocus - but neither of these work...


Hi Nick,

You *could* spit out a scriptblock and write a javascript function to the
page in the focus'ing the control of your choice, you'd need to write an
"onload" attribute/value to the BODY tag also...

Hope this helps..

Regards

Rob


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-21-2005
You could output some JavaScript, as in this example I put together:
http://SteveOrr.net/faq/2in1.aspx

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


"Nick S" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When I validate data in a field, the form does a postback - and focus goes
> back to the first control. How do I change focus to a different textbox. I
> though texbox.focus or textbox.setfocus - but neither of these work...
>
> Thanks
>



 
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