467,892 Members | 1,936 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,892 developers. It's quick & easy.

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

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.
Oct 4 '07 #1
  • viewed: 1296
Share:
1 Reply
On Oct 4, 11:33 am, "Mufasa" <j...@nowhere.comwrote:
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

Oct 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Scott M. | last post: by
6 posts views Thread by Sunil | last post: by
3 posts views Thread by JJ | last post: by
1 post views Thread by robin9876 | last post: by
4 posts views Thread by =?Utf-8?B?UmVuYXVkIExhbmdpcw==?= | last post: by
1 post views Thread by Mufasa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.