Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto-scroll a webform?

Status
Not open for further replies.

LindaH

Programmer
Dec 12, 2001
42
US
I've got a fairly long webform defined so the browser automatically puts the scroll bar at the right so I can scroll down to see everything on the form. If I find an entry error about 2/3 of the way down on the form, I want to set the focus to the control in error AND automatically scroll down to show that part of the form.

I've got the focus set, but I can't figure out how to do the auto-scroll or positioning of the form to the control in error. Is there anyway to do this?
 
You may want to consider some of the basic tricks of html for this namely placing uniquely named anchors at each and every row of your display. Then when you are refreshing the page append a #anchorname to the end of the page url.

I do not know how this will work with what you are doing but you may want to look into it.

Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
Thanks; pursuing this a little further, can you add a little snippet of code to explain what you mean by, &quot;... when you are refreshing the page append a #anchorname to the end of the page url.&quot; Would this mimic pressing an <a href=#name> link?
 
You would put on each line

<a name=UniqueNameHere>

Then if you want the page to scroll to that spot you call the page with

PageName.aspx#UniqueNameHere

Now I am not certain how you will get it to work with your page exactly but I know I have used it quite often with coldfusion and I am sure it should be workable in asp.net although I have not used it yet.

I hope this helps some. Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top