Asp.Net UpdatePanel 在移动浏览器上无法正常工作

问题描述

我在 UpdatePanel 中有一个复选框和一个下拉列表(首先禁用)。如果选中该复选框,则下拉列表将启用。

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
    <ContentTemplate>
        <asp:CheckBox ID="CheckBox" OnCheckedChanged="CheckBox_CheckedChanged" runat="server" />
        <asp:DropDownList ID="DropDownList" Enabled="false" runat="server"></asp:DropDownList>
    </ContentTemplate>
</asp:UpdatePanel>

背后的C#代码

    protected void CheckBox_CheckedChanged(object sender,EventArgs e)
    {
        if (DropDownList.Enabled)
            DropDownList.Enabled = false;
        else
            DropDownList.Enabled = true;
    }

在桌面浏览器(例如 Chrome)上运行良好。另一方面,在选中复选框时,在移动浏览器(在IOS上的Safari)上时,没有任何反应。我相信它与 UpdatePanel 相关,但我不确定为什么在桌面浏览器上它工作正常,而在 IOS 中的 Safari 上它无法正常工作。 我已经设法在 ScriptManager 中使用以下代码在移动设备上绕过它:

<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="false" runat="server"></asp:ScriptManager>

但后来我几乎失去了 UpdatePanel 的全部意义,因为它使页面在每次回发时刷新......

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)