Javascript ASP.NET:UpdateProgress不适用于具有ClientIDMode=“Static”的控件

Javascript ASP.NET:UpdateProgress不适用于具有ClientIDMode=“Static”的控件,javascript,asp.net,static,updatepanel,updateprogress,Javascript,Asp.net,Static,Updatepanel,Updateprogress,看看这个标记: <asp:UpdatePanel ID="Panel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="cboBox1" ClientIDMode="Static" AutoPostBack="true" runat="server" /> </ContentTemplate> <

看看这个标记:

<asp:UpdatePanel ID="Panel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:DropDownList ID="cboBox1" ClientIDMode="Static" AutoPostBack="true" runat="server" />
    </ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:DropDownList ID="cboBox2" runat="server" />
        <asp:UpdateProgress ID="UpdateProgress1" style="display: inline" AssociatedUpdatePanelID="Panel1" DynamicLayout="false" DisplayAfter="0" runat="server">
            <ProgressTemplate>
                <img src='<%= ResolveClientUrl("~/Images/indicator.gif")%>' border="0" alt="" />
            </ProgressTemplate>
        </asp:UpdateProgress>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="cboBox1" EventName="SelectedIndexChanged" />
    </Triggers>
</asp:UpdatePanel>
UpdateProgress控件最初起作用,但当我们将ClientMode=Static添加到cboBox1时,它就坏了。将其恢复为AutoID不是一个选项,因此我需要找到允许UpdateProgress面板使用ClientdMode=Static的解决方案


另外,是否有人可以将ClientMode添加到标记列表中?

看起来这是PageRequestManager中的一个错误,因为postBackElement没有传递给beginRequest事件处理程序。 对于此特定问题,您可以使用以下脚本:

$(function () {
     $("#cboBox1").live("change", function () {
          window.setTimeout(function () {
               var progress = $find("<%= UpdateProgress1.ClientID %>");
               // since you use 0 DisplayAfter property value you may 
               // just call progress.set_visible(true);
               // without timeout usage
               window.setTimeout(function () { progress.set_visible(true); }, progress.get_displayAfter());
          }, 0);
     });
});

我可以问一下为什么必须使用静态客户端模式吗?您是否在某些javascript中使用该控件?为什么AutoID模式不是一个选项?是的,我们在javascript中使用它,但javascript是从另一个文件导入的,因此我们不能使用服务器标记。我们可以将各种Javascript函数移到主页面上,但这是我们不想在游戏后期这么做的事情。我们从一个离岸开发团队那里继承了这个写得很糟糕的应用程序,但它与最佳实践不符,所以我们现在正在尽我们所能,直到重新编写它的时候。还有更多的问题,所以在这个问题上你只能相信我。你在你的项目中使用jquery吗?这只是个问题,我不是说你应该使用它?如果是这样,您可以使用属性选择器选择使用clientdmode=AutoID创建的元素:$'select[id$=cboBox2]'id以cboBox2结尾我们使用jquery。如果我真的得到了cboBox2的参考资料,我会用它做什么?很好!工作。这是一个骇客,但我现在要和它一起跑。