Overriding SmartNavigation To Automatically See ValidationSummary At Top Of Page

D

Dan Sikorsky

I'm using SmartNavigation and need to automatically scroll to the top of the
page when the ValidationSummary control catches errors and displays them, so
that the user can see the errors without having to manually scroll to the
top.

How can I determine if the ValidationSummary will display errors so that I
can issue a javascript window.scrollTo(0,0) or document.body.scrollTop = 0
(or something more appropriate) to automatically scroll to the top of the
page, thereby circumventing the SmartNavigation feature?

In my .aspx file, I have:

<asp:validationsummary id="valValSummary" runat="server" headertext="There
are problems with the following fields:"></asp:validationsummary>

If no validation errors occur (no adjusting of the scroll position is
needed), then the user sees nothing. If validation errors exist, then the
user sees the headertext followed by each validation control's error message
in a bulleted list.

My first thought is to determine - on the server side during a postback - if
valValSummary is set to the headertext; how would this be done?
 
B

bruce barker

i assume you are doing server validation, as client validation already does
this. you will have to emit javascript that detects its in the smartnav
iframe, and scroll its parent window, or better yet, in the smartnav.js
update the __smartNav.restoreFocus function to do this for you.


-- bruce (sqlwork.com)




| I'm using SmartNavigation and need to automatically scroll to the top of
the
| page when the ValidationSummary control catches errors and displays them,
so
| that the user can see the errors without having to manually scroll to the
| top.
|
| How can I determine if the ValidationSummary will display errors so that I
| can issue a javascript window.scrollTo(0,0) or document.body.scrollTop = 0
| (or something more appropriate) to automatically scroll to the top of the
| page, thereby circumventing the SmartNavigation feature?
|
| In my .aspx file, I have:
|
| <asp:validationsummary id="valValSummary" runat="server" headertext="There
| are problems with the following fields:"></asp:validationsummary>
|
| If no validation errors occur (no adjusting of the scroll position is
| needed), then the user sees nothing. If validation errors exist, then the
| user sees the headertext followed by each validation control's error
message
| in a bulleted list.
|
| My first thought is to determine - on the server side during a postback -
if
| valValSummary is set to the headertext; how would this be done?
|
|
| --
| Thank you kindly,
| Dan Sikorsky BAB, BScE, MSC
|
|
|
|
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top