7

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

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

Jon Adams
  • 24,464
  • 18
  • 82
  • 120
oscilatingcretin
  • 10,457
  • 39
  • 119
  • 206
  • May I ask why you have to use the static client mode? Are you using that control in some javascript? – TheGeekYouNeed Dec 05 '11 at 12:36
  • Why is "AutoID" mode not an option ? – Didier Ghys Dec 05 '11 at 12:36
  • Yes, we're using it in Javascript, but the Javascript is imported from another file, so we can't use server tags. We could move the various Javascript functions to the main page, but that is something we don't want to do this late in the game. We inherited this poortly written app from an off-shore dev team and it does not play well with best practices, so we're doing what we can for now until it's time to rewrite it from the ground up. There's more to it than that, so you will just have to trust me on this one. – oscilatingcretin Dec 05 '11 at 12:41
  • 1
    Do you use jquery in your project (it's just a question, i'm not telling you should use it...) ? If so, you can select your elements created with ClientIDMode="AutoID" by using the attributes selectors: `$('select[id$=cboBox2]')`(id ends with "cboBox2") – Didier Ghys Dec 05 '11 at 12:56
  • We use jquery. If I did get a reference to cboBox2, what would I end up doing with it? – oscilatingcretin Dec 05 '11 at 13:06
  • oscilatingcretin -- you would do the same thing with it as you would with the static name. – TheGeekYouNeed Dec 05 '11 at 14:50

1 Answers1

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:

$(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);
     });
});
Yuriy Rozhovetskiy
  • 22,270
  • 4
  • 37
  • 68