Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Client-side validation is resetting scroll position

Thread Tools

Client-side validation is resetting scroll position
Posts: n/a
Hello all,

I have a "comments" page that contains three sections; the article to
be commented on is on top, followed by previous comments, and on the
bottom a place to add new comments. It's a pretty common scenario.

I have two links from the main article page; one to view the comments
and one to add a new comment. I'm simply using <span id="top"> and
<span id="bottom">, and #top or #bottom in the query string to
distinguish between the two. This works beautifully.

However, the issue comes with the client-side validation. I'm using
ASP.NET 2.0's built-in validation controls. For some reason, the
javascript that validates the controls when I hit my submit button is
automatically scrolling the page back to the top, which is unacceptable
because the user has to scroll back down to the bottom every time there
is an error with their entry. The page is not posting back at this
point; I've read numerous articles on how to maintain scroll position
across postbacks, but this is client-side validation.

On a further note, my site works properly without javascript enabled as
well. ASP.NET's validation controls handle this properly and simply
post back to the server to do all validation. In this scenario, I'd
like to know of a way to scroll back down to the bottom of the page if
errors occurred in the validation, or stay at the top if they did not.

Any ideas/suggestions/solutions would be greatly appreciated, and I'm
willing send $5 via PayPal to whoever can solve my problem. Not that
$5 is a lot of money .

Thanks for your help in advance!


Reply With Quote

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
Resetting Validation Controls via Reset Button NancyASAP ASP .Net 2 10-16-2007 03:52 AM
Resetting scroll position in MaintainScrollPositionOnPostBack Chris Rathman ASP .Net 0 05-15-2006 07:56 PM
change the scroll speed of a scroll pane? Kevin Java 1 02-05-2005 09:42 AM
prevent mouse scroll to scroll in a dropdownlist nicholas ASP .Net 0 12-07-2004 11:26 AM
RE: Datagrid, validation and scroll position... Steven Cheng[MSFT] ASP .Net 2 07-22-2004 09:18 AM