我看到更新updatepanel后,ASP.NET页面可以滚动到顶部 [英] I see may ASP.NET page scroll to top after updatepanel is updated

查看:80
本文介绍了我看到更新updatepanel后,ASP.NET页面可以滚动到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <%@     Page    语言  =  C#    AutoEventWireup   =  true    CodeFile   =  Default.aspx.cs   继承  =  _Default    MaintainScrollPositionOnPostback   =  true   %>  
< asp:DropDownList ID = DropDownList1 runat = 服务器 AutoPostBack = True OnSelectedIndexChanged = DropDownList1_SelectedIndexChanged ClientIDMode = AutoID >
< asp:ListItem 已选择 = True = XXX > XXX < / asp:ListItem >
< asp:ListItem Value = YYY > YYY < / asp:ListItem >
< / asp:DropDownList

< asp:UpdatePanel ID = UpdatePanel1 runat = server UpdateMode = 条件 >
< ContentTemplate >
< asp:GridView ID = GridView1 runat = 服务器 AutoGenerateColumns = 错误 DataSourceID = SqlDataSource1 CssClass = BoxShadow表table-hover table-condensed table-bordered RTL 字体大小 = Medium Font-Bold = true BackColor = 白色 < span class =code-attribute> BorderStyle = Double >
< / asp:GridView >
< / ContentTemplate >
< 触发器 >
< asp:AsyncPostBackTrigger ControlID = DropDownList1 EventName = SelectedIndexChanged < span class =code-keyword> / >
< /触发器 >
< / asp:UpdatePanel >





我尝试了什么:



我确实尝试更改updatemode和.Net ver。

设置

 MaintainScrollPositionOnPostback =true



但是在updatepanel刷新之后页面会上升

我还能做什么???

解决方案

试试这个

smartNavigation =trueMaintainScrollPositionOnPostback =true

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback="true" %>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" ClientIDMode="AutoID">
<asp:ListItem Selected="True" Value="XXX">XXX</asp:ListItem>
<asp:ListItem Value="YYY">YYY</asp:ListItem>
</asp:DropDownList

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" CssClass="BoxShadow table table-hover table-condensed table-bordered RTL" Font-Size="Medium" Font-Bold="true" BackColor="White" BorderStyle="Double">
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>



What I have tried:

I did try to change updatemode and .Net ver.
set the

MaintainScrollPositionOnPostback="true"


but the page goes up after updatepanel refresh
what else can i do???

解决方案

Try this
smartNavigation="true" MaintainScrollPositionOnPostback="true"


这篇关于我看到更新updatepanel后,ASP.NET页面可以滚动到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆