SmartNavigation and Determining If ValidationSummary Caught Any Errors

Discussion in 'ASP .Net Web Controls' started by Dan Sikorsky, Dec 1, 2004.

  1. Dan Sikorsky

    Dan Sikorsky Guest

    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?

    --
    Thank you kindly,
    Dan Sikorsky BAB, BScE, MSC
     
    Dan Sikorsky, Dec 1, 2004
    #1
    1. Advertising

  2. Dan Sikorsky

    Viksi Guest

    RE: SmartNavigation and Determining If ValidationSummary Caught Any Er

    You could add "#" to the address, or you could use java script to check for
    the value of a hidden value field.
    -Viksi

    "Dan Sikorsky" wrote:

    > 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?
    >
    > --
    > Thank you kindly,
    > Dan Sikorsky BAB, BScE, MSC
    >
    >
    >
     
    Viksi, Dec 1, 2004
    #2
    1. Advertising

  3. Dan Sikorsky

    Dan Sikorsky Guest

    Re: SmartNavigation and Determining If ValidationSummary Caught Any Er

    Could you clarify, with an informative example, what you mean by 'add # to
    the address' and 'check for the value of a hidden field'?

    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?

    "Viksi" <> wrote in message
    news:D...
    > You could add "#" to the address, or you could use java script to check

    for
    > the value of a hidden value field.
    > -Viksi
    >
    > "Dan Sikorsky" wrote:
    >
    > > 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?
    > >
    > > --
    > > Thank you kindly,
    > > Dan Sikorsky BAB, BScE, MSC
    > >
    > >
    > >
     
    Dan Sikorsky, Dec 2, 2004
    #3
  4. Dan Sikorsky

    Viksi Guest

    Re: SmartNavigation and Determining If ValidationSummary Caught An

    Hello Dan,

    Sorry for being to brief previously. You will be checking whether there were
    any errors or not on the server side. If the condition is such that you want
    to scroll at the top, you can do one of the following:

    - Add "#" to the address of the response. For example, if your page is
    errors.aspx, the address would be "http://.../errors.aspx#". This will cause
    the scroll to top.

    - Second option would be to createa hidden field where you specify 'True' or
    'False' for example on whether you should scroll or not. Then, in java script
    on the client side, you can check for the value of that hidden field to
    determine whether you want to scroll or not.

    I hope that helps.
    -Viksi

    "Dan Sikorsky" wrote:

    > Could you clarify, with an informative example, what you mean by 'add # to
    > the address' and 'check for the value of a hidden field'?
    >
    > 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?
    >
    > "Viksi" <> wrote in message
    > news:D...
    > > You could add "#" to the address, or you could use java script to check

    > for
    > > the value of a hidden value field.
    > > -Viksi
    > >
    > > "Dan Sikorsky" wrote:
    > >
    > > > 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?
    > > >
    > > > --
    > > > Thank you kindly,
    > > > Dan Sikorsky BAB, BScE, MSC
    > > >
    > > >
    > > >

    >
    >
    >
     
    Viksi, Dec 2, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    985
    Mark Goldin
    Jan 17, 2004
  2. Dan Sikorsky
    Replies:
    1
    Views:
    455
    bruce barker
    Dec 2, 2004
  3. daniel
    Replies:
    1
    Views:
    411
    Juan T. Llibre
    Jan 23, 2005
  4. Keith Patrick

    Page level errors not getting caught

    Keith Patrick, Nov 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    347
    Keith Patrick
    Nov 17, 2005
  5. Netwhiz

    validationsummary duplicates errors

    Netwhiz, Feb 17, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    429
    Netwhiz
    Feb 17, 2005
Loading...

Share This Page