Help Please: focus on a label (or hidden field) after a button cli

G

Guest

On my page, I want to set the focus to the top of the page (where I have a
message in a label) after a button is clicked. How can I use javascript on
the server side to set the focus either to a label OR a hidden input field?
I do not have any textboxes on the page. The reason I need this is because I
have a datagrid with potentially a LOT of records in it. The user can change
these records, and click a Save button at the bottom of my page. After
saving, I want the focus to move to the top of my page where the confirmation
message will be displayed.

Can you set focus to a label or hidden field possibly? IF not, are there any
other ideas?
 
A

Adrian

Hi!
Use the scroll method instead. For instance, on PageLoad, add:
Button1.Attributes.Add("OnFocus", "return window.scroll(0,0)");

Hope that helps.
Best regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top