Last post Oct 18, 2016 11:35 AM by Eric Du
Oct 06, 2016 03:06 PM|wonjartran|LINK
In a VS2010/ASP.net 4 webpage, I have had a DDL with a submit button in the middle of the codes. When selecting an item from the DDL and clicking the Submit button, the webpage was moved to the top of the page, instead of displaying the GrdiView for the
DDL selected item on the page. Why?
Oct 06, 2016 03:10 PM|paindaasp|LINK
You are reposting the page. Try putting this on your ASPX Page directive:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="xx.aspx.vb" Inherits="myclass.xx" MaintainScrollPositionOnPostback="true" %>
Oct 06, 2016 04:05 PM|wonjartran|LINK
I added MaintainScrollPositionOnPostback="true" into two webpages. Both pages have a DDL in the middle of the page. One did not move to the top still showed the below Gridview on the spot. The other page moved to the top of page still
moved to the top. Why?
BTW, with a Submit button, the AutoPostBack of both DDLs is set to False. What else can be the problem?
Oct 07, 2016 08:22 AM|Eric Du|LINK
According to your description , I suggest you use ScriptManger and UpdatePanel control . this can realize page not refresh after click button , it also not move to the top.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
Oct 07, 2016 10:52 AM|paindaasp|LINK
wonjartran, are you saying that you have 2 pages, and one maintains position, while one jumps to the top of the page? Perhaps, if you show your ASPX code, and code behind we can investigate further.
Oct 07, 2016 04:00 PM|wonjartran|LINK
This is the 2nd DDL code, the 1st DDL code is the same. With AutoPostBack=false, we need to click the Submit button to display the GrdiView/ListView. My problem is if I click the 2nd Submit button, the screen was moved to the top to display the GridView of
the 1st DDL selected, and we can not see the ListView for the 2nd DDL if the GridView is a long list of records.
Oct 18, 2016 11:35 AM|Eric Du|LINK
As far as I know , your issue may be caused by page refresh , I suggest you use scriptmanger and updatepanel , I hope you could try to use my code in your side , it can realize partial refresh avoid global refresh ! Also I hope you could provide the gif
that show the statement(up to top) and more detailed code !