MaintenanceScrollPositionOnPostback 页面指令不适用于 ajaxtoolkit 控件?
我在 TestPage.aspx 中使用 UpdataPanel 遇到 MaintenanceScrollPositionOnPostback 问题 页。
页眉:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Abc.master" AutoEventWireup="true"
MaintainScrollPositionOnPostback="true" CodeFile="Testpage.aspx.cs" Inherits="Testpage"
Title="Test Page" %>
我将 Ajaxtoolkit 控件注册到我的 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>
背后的原因是什么?
I getting issue with MaintainScrollPositionOnPostback with UpdataPanel in TestPage.aspx
page.
Page Header :
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Abc.master" AutoEventWireup="true"
MaintainScrollPositionOnPostback="true" CodeFile="Testpage.aspx.cs" Inherits="Testpage"
Title="Test Page" %>
I registered Ajaxtoolkit Control to my aspx page.
with
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
When I add " MaintainScrollPositionOnPostback="true" "page directive to my .aspx page
then I got the error message as shown in attached image.
Error: Status code returns from server:500
my Code
<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>
What is the reason behind that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
页面指令 - “MaintainScrollPositionOnPostback”不起作用
原因是
1) Framework 2.0 和
2) AjaxToolkit (ver 1.0.2....)
不支持 AJAX(异步调用)回发后重置位置。
Page directive - "MaintainScrollPositionOnPostback" not worked
Reason is that
1) Framework 2.0 and
2) AjaxToolkit (ver 1.0.2....)
Reset Position after AJAX (async call) postback not supported.