Two UpdatePanels working in parallel, one not updating
I have two update panels (lets call them A and B). In A, I have a simple checkbox. AutoPostback set to true. When you check it (or uncheck it), it will enable/disable a simple dropdown within the same UpdatePanel.
UpdatePanel B has a long running process in it. It fires off a request for a dropdown to be created that takes nearly 2 minutes to construct. If I load the page and don't touch anything, the dropdown is constructed after about 2 minutes and renders perfectly. However, if during that two minutes I decide to check my checkbox (and cause a partial postback for panel A), updatepanel B never gets rendered. Whi开发者_运维百科le debugging, I found that it is completing its retrieval successfully, but the actual panel never refreshes to show the control.
I have tried using UpdateMode = Conditional on panel B (to ensure it would not be disturbed by panel A) and it produces the same results. I have verified that B.Update() is being called also.
EDIT
Panel A:
<asp:UpdatePanel ID="upMailScrub" runat="server">
<ContentTemplate>
<asp:Button ID="btnAnalyzeLaunch" runat="server" onclick="btnAnalyzeLaunch_Click" Text="Analyze Launch" style="display: none" />
<table>
<tr>
<td><asp:CheckBox ID="cbxScrub" runat="server" Checked="true"
oncheckedchanged="cbxScrub_CheckedChanged" AutoPostBack="True" /></td><td><label for="cbxScrub">Scrub this campaign</label></td>
<td style="padding-left: 10px">
Vendor: <asp:DropDownList ID="ddlScrubVendor" runat="server">
<asp:ListItem Text="LexisNexis" Value="LexisNexis" />
</asp:DropDownList>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Panel B:
<asp:UpdatePanel ID="upDdlCampaigns" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAnalyzeLaunch" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:HiddenField id="hidAction" runat="server" />
<asp:Panel ID="pnlPleaseWait" runat="server"><img src="style/images/PleaseWait.gif" /> Please wait while the Five9 Campaigns are retrieved...</asp:Panel>
<asp:DropDownList ID="ddlCampaigns" Visible="false" runat="server" class="required"
AutoPostBack="True" OnSelectedIndexChanged="ddlCampaigns_SelectedIndexChanged" />
<asp:Button ID="btnRefreshDDL" runat="server" onclick="btnRefreshDDL_Click" style="display: none" />
</ContentTemplate>
</asp:UpdatePanel>
Any suggestions? Thanks.
You ask too much from UpdatePanel :)
UpdatePanel can not work with 2 parallel request that way. Consider to make some ajax call to get your results.
Why you may ask, one basic reason is that every page have only one viewstate. When you ask from the A or the B, UpdatePanel to send/get data, then the viewstate must change to a new viewstate. Now, when you ask a result from A, and before you end, you ask results from B, you going to get 2 different viewstate, and one of them is going to fail because in the middle time have change.
ViewState is not the only think, in every update panel click, the page post back all inputs post to page, both A and B inputs and all the rest inside the page, this is also a problem. Imaging this for example, you trigger A UpdatePanel with inputs A+B, and then before the A ends, you trigger B UpdatePanel with the same inputs. Now A, waits for results from A+B, the same and B, but in the middle time the A+B results from A is now different because B has change them - and fails.
精彩评论