我在TestPage.aspx中使用UpdataPanel来解决MaintainScrollPositionOnPostback的问题
页。
页眉:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Abc.master" AutoEventWireup="true"
MaintainScrollPositionOnPostback="true" CodeFile="Testpage.aspx.cs" Inherits="Testpage"
Title="Test Page" %>
我将Ajaxtoolkit Control注册到我的aspx页面。
与
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
当我将“MaintainScrollPositionOnPostback =”true“”页面指令添加到我的.aspx页面时 然后我收到了错误信息,如附图所示。
错误:状态代码从服务器返回:500
我的代码
<asp:updatepanel id="upAnatomicalConfig" runat="server" updatemode="Conditional">
<ContentTemplate>
<div id="divform" style="width: 98%; text-align: left; margin: 0 auto" class="W_B">
<div>
<asp:validationsummary id="valsum" runat="server" validationgroup="abc" showmessagebox="true"
displaymode="BulletList" enableclientscript="true" showsummary="false" />
</div>
<!-- Here is some text box that I used for Save -------->
<asp:button id="btnSave" runat="server" text="Save" cssclass="button" causesvalidation="true"
validationgroup="abc" onclick="btnSave_Click" />
<asp:button id="btnCancel" runat="server" text="Cancel" cssclass="button" onclick="btnCancel_Click"
causesvalidation="false" />
<asp:datagrid id="dtgrid" runat="server" width="100%" cssclass="dgGrid" onitemdatabound="dtgrid_ItemDataBound"
cellpadding="2" autogeneratecolumns="false" showfooter="true" showheader="true"
onitemcreated="dtgrid_ItemCreated" allowpaging="True" pagesize="25" allowcustompaging="True"
gridlines="None" allowsorting="true" borderwidth="0px" borderstyle="None" onpageindexchanged="dtgrid_PageIndexChanged"
onsortcommand="dtgrid_OnSortCommand">
<Columns>
<asp:TemplateColumn HeaderStyle-Width="5%" ItemStyle-Width="5%">
<ItemTemplate>
<asp:ImageButton ID="ibtnEdit" CausesValidation="false" OnClick="ibtnEdit_Click"
runat="server" ImageUrl="~/Images/Edit.gif" ToolTip="Edit Template" CommandArgument='<%# Eval("tblID") %>'>
</asp:ImageButton>
<asp:ImageButton ID="ibtnDisc" CausesValidation="false" OnClick="ibtnDisc_Click"
runat="server" ImageUrl="~/Images/inactive_record.gif" ToolTip="Move to inactive"
CommandArgument='<%# Eval("tblID") %>'></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
</Triggers>
</asp:updatepanel>
背后的原因是什么?
答案 0 :(得分:0)
页面指令 - “ MaintainScrollPositionOnPostback ”无效
原因是1)Framework 2.0和
2)AjaxToolkit(ver 1.0.2 ....)
在AJAX(异步调用)回发后重置位置不支持。< / p>