Scroll page and position at callout box after click on button.



 <%-- aspx code--%>
---------------

<input type="button" value="Submit Review"  ValidationGroup="LApproval" class="login-buttonLginpage" onclick="validationCalloutPostionAdjust('LApproval'); showpopup('LApproval');" />

 ----------------
 <%-- Script --%>

function validationCalloutPostionAdjust(validationGroup) {
    //To find all the ValidationCallout client behavior
    Page_ClientValidate(validationGroup);
    var currentBehavior = null;
    var allBehaviors = Sys.Application.getComponents();
    for (var loopIndex = 0; loopIndex < allBehaviors.length; loopIndex++) {
        currentBehavior = allBehaviors[loopIndex];
        if (currentBehavior != null) {

            //execute the operation of changing the popup's position
            if (currentBehavior._popupBehavior && currentBehavior._popupBehavior._visible != null && currentBehavior._popupBehavior._visible == true) {

                var currentX = currentBehavior._elementToValidate.offsetWidth;

                window.scrollTo(currentBehavior._popupBehavior._element.offsetLeft, currentBehavior._popupBehavior._element.offsetTop);


            }
        }
    }
}

Comments

Popular posts from this blog

Executing PowerShell scripts from C#

HOW TO Use the NumericUpDown Control

Exposing Agile Software Development Myths