PC Review


Reply
Thread Tools Rate Thread

Could of field with autopostback - how to be able to set focus correctly.

 
 
Mufasa
Guest
Posts: n/a
 
      4th Oct 2007
I have a couple of fields that are autopostback and I want to make tab work
correctly between them. But whenever somebody changes the value and clicks
somewhere else the page reloads as it should but there is no field with
focus.

So how can I tell what field the user clicked on before the page reloads,
save that and set the focus to that field once they are done.

TIA - J.


 
Reply With Quote
 
 
 
 
Elroyskimms
Guest
Posts: n/a
 
      5th Oct 2007
On Oct 4, 11:33 am, "Mufasa" <j...@nowhere.com> wrote:
> I have a couple of fields that are autopostback and I want to make tab work
> correctly between them. But whenever somebody changes the value and clicks
> somewhere else the page reloads as it should but there is no field with
> focus.
>
> So how can I tell what field the user clicked on before the page reloads,
> save that and set the focus to that field once they are done.
>
> TIA - J.


I don't think what you are looking for can be done without client
scripting of some kind (Javascript). The PostBack will result in the
page being redrawn and the tab position being reset to the 1st Control
in the Control tree. In the OnChanged event (server-side), you could
possibly use the ClientID attribute of the Texbox Controls and use
response.write("<script language=javascript>SET FOCUS USING JAVASCRIPT
HERE</script>").

I've used something similar in the past but IE7 broke that code so I
won't post it here. Actually, the code wasn't to standard so I can't
blame IE7 for my bad programming :-)

Anyway, something like that should work but it may cause other
problems and may not be cross-browser compatible... you'll want to
check on that too.

HTH,

-E

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Autopostback field with a check. Mufasa Microsoft ASP .NET 2 3rd Oct 2007 03:57 AM
AutoPostBack on TextBox loses Focus - Steve - Microsoft ASP .NET 3 29th Jun 2004 09: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 Microsoft ASP .NET 2 29th Jun 2004 02:28 PM
autopostback not going to next field Thomas Scheiderich Microsoft ASP .NET 0 17th Feb 2004 03:20 PM
TextBox AutoPostBack event not firing correctly Ben Fidge Microsoft ASP .NET 2 30th Jan 2004 12:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 AM.