MaintenanceScrollPositionOnPostback 页面指令不适用于 ajaxtoolkit 控件?

发布于 2025-01-07 06:32:49 字数 3055 浏览 1 评论 0原文

我在 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" />
    &nbsp;
    <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.

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪意 2025-01-14 06:32:49

页面指​​令 - “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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文