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

时间:2022-08-25 17:17:56

Look at this markup:

看看这个标记:

<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>

The UpdateProgress control worked initially, but broke when we added ClientMode="Static" to the cboBox1. Reverting it back to AutoID is not an option, so I need to find solutions that allow the UpdateProgress panel to work with ClientIDMode="Static".

UpdateProgress控件最初工作,但是当我们将ClientMode =“Static”添加到cboBox1时,它就崩溃了。将其还原为AutoID不是一个选项,因此我需要找到允许UpdateProgress面板与ClientIDMode =“Static”一起使用的解决方案。

Also, could someone add "clientidmode" to the list of tags?

此外,有人可以在标签列表中添加“clientidmode”吗?

1 个解决方案

#1


2  

Looks like this is a bug in PageRequestManager since postBackElement doesn't passed to beginRequest event handler. For this particular issue you may use following script:

看起来这是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);
     });
});

#1


2  

Looks like this is a bug in PageRequestManager since postBackElement doesn't passed to beginRequest event handler. For this particular issue you may use following script:

看起来这是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);
     });
});