Unable to update second update panel

I have 3 updates on my page and I want 2 of them to be updated when the event fires. In one of the update panels, I have asp ReoderList.

<asp:UpdatePanel ID="upMain" UpdateMode="Conditional" runat="server" style="left: 0px; top: 0px; min-height: 100px; width: 495px; overflow: auto;">
                <ContentTemplate>
                    <div class="reorderListDemo" style="position: relative; left: -41px; width: 490px; overflow: auto;">
                        <ajax:ReorderList ID="rlAlerts" Style="min-height: 100px; padding: 0px 6px 0px 0px;" Width="480px" runat="server" PostBackOnReorder="false" CallbackCssStyle="callbackStyle" DragHandleAlignment="Left" DataKeyField="ItemID" SortOrderField="Priority" OnItemReorder="rlAlerts_ItemReorder">
                            <ItemTemplate>
                                <%--set the class to inactiveAlert if the active flag is set to false--%>
                                <div id="alertItem<%# Eval("ItemID")%>" class="<%# Convert.ToBoolean(Eval("Active")) ? "" : "inactiveAlert" %>" onclick="updateAlertPreview('<%# Eval("ItemID")%>','<%# Eval("Priority")%>','<%# Eval("Title") %>','<%# Eval("Description") %>', '<%# Eval("StartDate") %>', '<%# Eval("EndDate")  %>', '<%# Eval("Image") %>');">
                                    <div style="position: relative; float: left; left: 10px; padding-top: 6px; overflow: hidden; width: 180px; height: 17px;">
                                        <asp:Label ID="Label4" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Title"))) %>' />
                                    </div>
                                 </div>
                            </ItemTemplate>
                            <ReorderTemplate>
                                <asp:Panel ID="Panel2" runat="server" CssClass="reorderCue" />
                            </ReorderTemplate>
                            <DragHandleTemplate>
                                <div class="dragHandle">
                                </div>
                            </DragHandleTemplate>
                        </ajax:ReorderList>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="rlAlerts" EventName="ItemReorder" />
                    <asp:AsyncPostBackTrigger ControlID="ckbxShowInactive" EventName="CheckedChanged" />
                </Triggers>
            </asp:UpdatePanel>

Currently, this update panel will be updated, either the items will be reordered, or the status of the checkbox will change. Now I have this second updatePanel, which does not update when the list is reordered.

<asp:UpdatePanel ID="UpdatePanelAlertOrderNotification" UpdateMode="Conditional" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="lblOrderChangedNotification" runat="server"></asp:Label>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="rlAlerts" EventName="ItemReorder" />
                    </Triggers>
                </asp:UpdatePanel>

Here is my code:

    protected void rlAlerts_ItemReorder(object sender, AjaxControlToolkit.ReorderListItemReorderEventArgs e)
        {
           .....
           Session["AlertOrderChangedNotification"] = Resources.LocalizedText.Alert_Order_Changed;

            lblOrderChangedNotification.Text = "AWESOME";
            //lblOrderChangedNotification.DataBind();
            //UpdatePanelAlertOrderNotification.Update();
}

I went through the code and I can not understand why it does not work.

, : :     UpdatePanelAlertOrderNotification UpdateMode .     UpdatePanelAlertOrderNotification UpdateMode ,          updatepanel .    , , . Load   . ( , 1, .)

protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AlertOrderChangedNotification"] != null)
            {
                lblOrderChangedNotification.Text = Session["AlertOrderChangedNotification"] as string;
                //lblOrderChangedNotification.DataBind();
                //UpdatePanelAlertOrderNotification.Update();
            }
        }

, , (     UpdatePanelAlertOrderNotification .)

Changs: . . , . , : 2 ? , , UpdatePanelAlertOrderNotification.Update()?? ?

<div style="position: absolute; top: 195px; right: 10px; height: 100px; width: 120px; overflow: hidden;">
                    <asp:UpdatePanel ID="UpdatePanelAlertOrderNotification" UpdateMode="Conditional" runat="server">
                        <ContentTemplate>
                            <asp:Label ID="lblOrderChangedNotification" runat="server"></asp:Label>
                        </ContentTemplate>
                        <Triggers>
                            <%--<asp:AsyncPostBackTrigger ControlID="rlAlerts" EventName="ItemReorder" />--%>
                            <asp:AsyncPostBackTrigger ControlID="btnUpdateBrokenUpdatePanel" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
                    <div style="position: relative; top: 25px; left: 10px;">
                        <asp:Button ID="btnUpdateBrokenUpdatePanel" runat="server" CssClass="redButton" Width="300px" Height="25px" Text="Update Broken UPdatePanel" OnClick="btnUpdateBrokenUpdatePanel_Click" />
                    </div>

.

+3
2

, , , , .

, , , , .

0

, rlAlerts , , rlAlerts, 1- UpdatePanel.

:

  • rlAlerts ,
  • ItemReorder UpdatePanelAlertOrderNotification.Update(). SOUND, , , .
  • prerender:

    UpdatePanelAlertOrderNotification.Triggers.Add( AsyncPostBackTrigger()   {ControlID = rlAlerts.UniqueID, EventName = "ItemReorder" });

0

Source: https://habr.com/ru/post/1754999/


All Articles