Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a very big form with lots of questions for the user to answer. Almost all of the controls are AutoPostBack as some other controls are enabled/disabled depending on thier answers. But if suppose I click on a radiobutton with AutoPostBack On, the page reloads as it should, but takes me to the top and then I have scroll back down to answer the next question. How to avoid that? It's a long form and I want theleast inconvenience to the user....
Posted
Comments
Dholakiya Ankit 16-Sep-13 2:22am    
Do not go server side do it by client side

you have two options
1] use update panel like:-

XML
<asp:UpdatePanel ID="updpnlRefresh" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                   //your controls
               </ContentTemplate>
</asp:UpdatePanel>


and update it on any action like:- updpnlRefresh.Update()

Or

2] use
MaintainScrollPositionOnPostback="true"
in your aspx page (page directive)
like

VB
<%@ Page Title="Detail" Language="VB" MasterPageFile="~/Site.master"
    AutoEventWireup="false" CodeFile="Detail.aspx.vb" Inherits="Detail_Page"
    MaintainScrollPositionOnPostback="true" %>
 
Share this answer
 
v2
Comments
Muhammad Fawad 2022 8-Jun-22 2:35am    
Thanks for your Help
Just paste MaintainScrollPositionOnPostback="true" in page directive.
VB
<%@ Page Title="ABC" Language="C#" MasterPageFile="~/ABC.master" AutoEventWireup="true"
    CodeFile="Lesson.aspx.cs" Inherits="Lesson" ValidateRequest="false" MaintainScrollPositionOnPostback="true" %>
 
Share this answer
 
Use
<%@ Page MaintainScrollPositionOnPostback="true" %>
in your page directive. Thats it.

Regards..:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900