When I assign the AssociatedUpdatePanelId, the progress does not display when I select a state, but when I leave it blank, it displays the progress.
Here is the aspx markup:
<div>
<asp:ListBox ID="lstStates" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="lstStates_SelectedIndexChanged" SelectionMode="Multiple">
</asp:ListBox>
</div>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlCounty" runat="server">
<asp:ListBox ID="lstCounties" runat="server" SelectionMode="Multiple">
</asp:ListBox>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lstStates" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" runat="server" DisplayAfter="1"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img src="../images/loader2.gif" />
Loading Counties...
</ProgressTemplate>
</asp:UpdateProgress>
</div>
According to this article, external triggers for an UpdatePanel do not fire an associated UpdateProgress, since the implementation of enabling the UpdateProgress control searches the control hierarchy for the calling control; an external trigger will not be present in the control hierarchy.
The article does, however, suggest injecting some JavaScript to make up for this error; I have modified it to (hopefully) fit your needs:
<script type="text/JavaScript" language="JavaScript">
function pageLoad()
{
var manager = Sys.WebForms.PageRequestManager.getInstance();
manager.add_endRequest(endRequest);
manager.add_beginRequest(OnBeginRequest);
}
function OnBeginRequest(sender, args)
{
var postBackElement = args.get_postBackElement();
if (postBackElement.id == 'lstStates')
{
$get('UpdateProgress2').style.display = "block";
}
}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With