In a Panel I have FileUpload and on 'show' button click I am able to see the selected image by bringing down the scroll bar every time. How to arrest the vertical scroll bar from moving upwards. I tried with the following code but no use.
<script type="text/javascript">
var FormHandlerProto = function() {
var Me = this;
this.lastScrollPos = 0;
this.SetupForm = function() {
// Bind a function to the form's scroll container
$("#Panel117").bind("scroll", function() {
// Record the scroll position
Me.lastScrollPos = $(this).scrollTop();
});
}
this.ScrollForm = function() {
// Apply the last scroll position
$("#Panel117").scrollTop(Me.lastScrollPos);
}
this.EndRequestHandler = function(sender, args) {
if (args.get_error() != undefined)
Me.ScrollForm();
}
}
}
var FormHandler = new FormHandlerProto();
FormHandler.Setup(); // This assumes your scroll container doesn't get updated on postback. If it does, you'll want to call it in the EndRequestHandler.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(FormHandler.EndRequestHandler);
</script>
<asp:Panel ID="Panel117" runat="server"
style="border-width: 1px; border-style: solid; top: 1475px; left: 125px; position: absolute; height: 161px; width: 279px; background-color:InactiveBorder; border-color:Black">
<asp:Image ID="ImagePreview" runat="server" Height="97px" Width="99px"
style="z-index: 1"/>
<asp:FileUpload ID="PhotoUpload" runat="server"
style="z-index: 1; left:100px; top: 53px; position: absolute; height: 46px; width: 218px; right: 90px;" />
<asp:UpdatePanel ID="UpdatePanel5" runat="server" >
<ContentTemplate>
<asp:Button ID="Button7" runat="server" CausesValidation="False" onclick="Showbutton_Click"
style="z-index: 1; left: 7px; top: 123px; position: absolute" Text="Show" />
</ContentTemplate>
<Triggers >
<asp:PostBackTrigger ControlID="Button7" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>