리피터가 포함 된 UpdatePanel이 있습니다. 중계기의 ItemTemplate에는 버튼과 레이블이 있습니다.리피터 내부에서 레이블이 리피터 내부에 보이지 않음
단추를 누르면 일부 기능이 수행 된 다음 레이블이 표시되고 해제됩니다.
그러나 UI 변경 사항이 웹 페이지에 적용되지 않습니다. 여기
디버거에서 단계별 때 잘 작동하는 표시 코드입니다 :protected void CommentRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "report")
{
(e.Item.FindControl("btnReportComment") as ImageButton).Enabled = false;
Label thanksLabel = (Label)e.Item.FindControl("lblReportedComment");
thanksLabel.Visible = true;
}
pnlCommentsUpdater.Update();
}
하고 페이지의 코드 (중계기의 외부 제외 코드)
내가 말했듯이
<asp:UpdatePanel UpdateMode="Conditional" ID="pnlCommentsUpdater" runat="server">
<ContentTemplate>
<asp:LinkButton ID="lnkPhoto1Comments" runat="server" Text="0 Comments" OnClick="lnkPhoto1Comments_Click" CssClass="dark-gray regular bold"></asp:LinkButton>
<asp:Panel ID="pnlPhoto1Comments" runat="server" Visible="False">
<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="CommentRepeater_ItemCommand">
<ItemTemplate>
<br />
<hr width="100%" size="1" color="#CCCCCC" />
<table width="534" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="150" align="left" valign="top">
<span class="blue small bold"><%# Eval("PostedBy") %>,</span><br />
<span class="light-gray small bold"><%# Eval("DateCreated", "{0:g}") %></span>
</td>
<td width="20"></td>
<td width="252" align="left" valign="top">
<div STYLE="word-wrap:break-word;width:252px;left:0">
<span class="dark-gray small bold"><%# Eval("CommentText") %></span>
</div>
</td>
<td width="20"></td>
<td width="92" valign="bottom">
<asp:ImageButton ID="btnReportComment" runat="server" ImageUrl="../images/inappropriate_off.png" CssClass="domclickroll images/inappropriate_on.png images/inappropriate_on.png" AlternateText="Inappropriate" CommandName="report" CommandArgument='<%#Eval("CommentId") %>' /><br />
<asp:Label ID="lblReportedComment" runat="server" Visible="false" CssClass="Regular bold blue" Text="Thanks. We'll check it out!"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
, 디버거는 잘 동작하는 것으로 보여 주지만 버튼을 클릭 한 후에는 브라우저에 레이블을 표시하지 않습니다.
누구나 내가 뭘 잘못하고 있는지 알아?
오류 : "Sys.WebForms.PageRequestManagerParserErrorException : 서버에서받은 메시지를 구문 분석 할 수 없습니다.이 오류의 일반적인 원인은 Response.Write(), 응답 필터, HttpModules 또는 서버 추적을 사용할 수 있습니다. "
그리고 내가 일부 사이트에서 읽은 페이지로드에서
ScriptManager.GetCurrent(Page).RegisterPostBackControl(Repeater1);
를 호출하고 솔루션이지만, 그것은 도움이되지 않았다.
어떤 이벤트 핸들러에서 RegisterPostBackControl을 호출해야합니까? –
감사합니다! –