c# - 使用更新面板转义关键问题

标签 c# asp.net internet-explorer-8 asp.net-4.0

当在包含内部任何控件的更新面板的页面上按 ESC 键两次时,假设文本框或列表框我收到 System.ArgumentException:无效的回发或回调参数。我检查了其余浏览器,它工作正常,但在 Internet Explorer 8 中,它创建了上述问题。

我找到的可能的解决方案是在页面级别或 webconfig 中设置EnableEventValidation="false",或者禁用转义键。我不想使用 2 个以前的解决方案,因为我的站点安全性会受到损害,而且我不想禁用转义键。

感谢任何建议/想法。

代码:

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"
        EnablePageMethods="true">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanelHeader" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div id="Search">
                <table style="empty-cells: hide;" width="100%" cellpadding="0" cellspacing="0" class="controlsTable">
                    <tr>
                        <td class="td4Caption">
                            Some Text
                        </td>
                        <td class="tdpadding">
                            <asp:TextBox ID="txtbox" ClientIDMode="Static" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:ImageButton SkinID="Export" AlternateText="Generate Report" ToolTip="Generate Report"
                                ID="ibtnGenerateReport" ValidationGroup="Generate" runat="server" OnClick="ibtnGenerateReport_Click" />
                        </td>
                    </tr>
                </table>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>

最佳答案

•您可以尝试的另一件事是:将 EnablePartialRendering="false"设置为 asp:ScriptManager

使用“edge”确保您的网站以适当的兼容性呈现: < meta http-equiv="X-UA-Compatible"content="edge"/>

如果以上都不起作用,请尝试像这样控制异常处理程序:

http://encosia.com/how-to-improve-aspnet-ajax-error-handling/

关于c# - 使用更新面板转义关键问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20897321/

相关文章:

c# - 减少数据库往返

c# - 如何在 Prism 应用程序中管理多个 TabControlItem 的内容?

c# - 将 for 循环更改为 Parallel.For 循环

javascript - 对于企业应用程序,输入验证应该是客户端还是服务器端?

internet-explorer-8 - IE8 强制兼容模式

c# - 我们可以在 'app.config' 文件中声明变量吗?

c# - 在 ASP.NET C# 中直接打印 Crystal Report

asp.net - MVC3 客户端验证不稳定/不一致

Jquery XML ie8 无法正常工作

javascript - Vimeo api 播放 IE8