SCROLLING A PAGE AFTER VALIDATION SHOWING VALIDATION POP UP

Tanuj Kumar

Total Post:134

Points:940
Posted by  Tanuj Kumar
 853  View(s)
Ratings:
Rate this:

i have a button on the bottom of the page OnClick it validates the form fields and if there is no valid field it displays a pop up message to enter the required fields using asp.net Validation Summary Control.

 I want that when it showing the pop up once user click on OK buttom of pop up window then it should scroll to top of the page to form area. 

Does any one have idea how to handle this to jump the page up?

 I am working in asp.net 3.5 +VS 2010. 

Thanks

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: Scrolling a Page after Validation showing Validation Pop Up

    Hi Tanuj, 


    Find a form element or the form and scrollTo() it:

     function scrollToElement(id)

     {

          var formElement = document.getElementById(id);

          if(formElement){

              window.scrollTo(0, formElement.offsetTop);

          }

     }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!