내 페이지에 3 개의 updatepanels가 있는데 이벤트가 발생하면 2 개의 업데이트 패널을 업데이트하고 싶습니다. 업데이트 패널 중 하나에서 나는 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>
현재이 업데이트 패널은 항목이 재정렬되거나 확인란 상태가 변경되면 업데이트됩니다. 이제 목록이 재정렬 될 때 업데이트되지 않는이 두 번째 updatePanel이 있습니다. 내가 코드를 밟은 적이
protected void rlAlerts_ItemReorder(object sender, AjaxControlToolkit.ReorderListItemReorderEventArgs e)
{
.....
Session["AlertOrderChangedNotification"] = Resources.LocalizedText.Alert_Order_Changed;
lblOrderChangedNotification.Text = "AWESOME";
//lblOrderChangedNotification.DataBind();
//UpdatePanelAlertOrderNotification.Update();
}
나는 그것이 작동하지 않는 이유를 알아낼 수 없습니다 :
<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>
다음은 뒤에 내 코드입니다.
피곤한 점 : 나는 피곤했다 : 항상 UpdatePanelAlertOrderNotification의 UpdateMode를 설정한다. UpdatePanelAlertOrderNotification의 UpdateMode를 조건부로 설정하고 해당 트리거를 제거하고 코드 숨김 기능을 사용하여 updatepanel을 직접 업데이트해야합니다. 은 세션에 텍스트를 저장하고 페이지 포스트가 실행되어 세션에 텍스트가 있는지 확인합니다. 나는이 코드를 pageLoad 함수에서 처리 할 수 있으며 여전히 아무 것도하지 않는다. (주석 모두 선으로 시도하고 만 1, 후 그들 중 누구도과 주석.)
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AlertOrderChangedNotification"] != null)
{
lblOrderChangedNotification.Text = Session["AlertOrderChangedNotification"] as string;
//lblOrderChangedNotification.DataBind();
//UpdatePanelAlertOrderNotification.Update();
}
}
나는이 두 업데이트 패널을 가지고 있기 때문에 나는이 문제에 봉착하면 나도 몰라 같은 트리거 (심지어 하지만 나는 UpdatePanelAlertOrderNotification에서 제거하고 항상으로 설정해야했습니다.)
챙을 : 그래서 나는 새로운 버튼을 추가하고 updatepanel 업데이트 얻기 위해 노력했다. 이 작동합니다. 트리거를 재주문 목록으로 다시 전환하면 작동하지 않습니다. 그래서 내 질문은, 나는 동일한 트리거와 2 개의 서로 다른 updatePanels 가질 수 있습니까? 만약 내가 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>
도움이 될 것입니다. 감사합니다 Brad
아마도 이것과 관련이 있습니까? UpdateMode = "조건부" 왜 항상 설정하지 않습니까? –
나는 그것을 항상 가지고 있었고 여전히 업데이트하지는 않았다. – Brad8118