Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Asp.Net AutoPostback and control focus

Reply
Thread Tools

Asp.Net AutoPostback and control focus

 
 
robin9876@hotmail.com
Guest
Posts: n/a
 
      06-21-2006
In Asp.Net v1.1 web form I have a number of controls which have the
autopostback enabled. Is it possible after the autopostback has run
that the control that caused the autopostback to get the focus?

 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      06-23-2006
I am not sure if there is a built-in way to do that, but you could generate
JavaScript that runs right away (not a function) that calls the focus()
method of the appropriate control. To do this, try using the following:


TextBox2.Page.RegisterClientScriptBlock("refocus", "<script
type=""text/javascript"">" & TextBox2.ClientID & ".focus();</script>")


I have not tested this code, but I would expect that it would work. Good
Luck!
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> In Asp.Net v1.1 web form I have a number of controls which have the
> autopostback enabled. Is it possible after the autopostback has run
> that the control that caused the autopostback to get the focus?
>



 
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
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
Asp.Net AutoPostback and control focus robin9876@hotmail.com ASP .Net 1 06-21-2006 03:27 PM
AutoPostBack on TextBox loses Focus - Steve - ASP .Net 3 06-29-2004 08:52 PM
how do you set focus to next control on controls with autopostback so you don't have to hit tab twice? Mad Scientist Jr ASP .Net 2 06-29-2004 01:28 PM
AutoPostBack and Focus... Pai ASP .Net Web Controls 1 11-14-2003 03:37 AM



Advertisments