나는 다음과 같이 내 중계기 내부 DIV 있습니다 중계기에서 DIV의 가시성을 전환하려면 어떻게해야합니까?
<asp:Repeater ID="topicView" runat="server" OnItemCommand="Delete_ItemCommand">
<ItemTemplate>
<table width="945px" cellpadding="0" cellspacing="0" border="0" class="post-table">
<tr>
<td colspan="2">
<div class="post-info">
<div class="post-info-left"><%#DataBinder.Eval(Container.DataItem, "PostDate")%></div>
<div class="post-info-right">#<%#DataBinder.Eval(Container.DataItem, "PostID")%></div>
<div class="clear"></div>
</div>
</td>
</tr>
<tr>
<td class="post-left">
<p><strong><%#DataBinder.Eval(Container.DataItem, "Username")%></strong></p>
</td>
<td class="post-right">
<p><%#DataBinder.Eval(Container.DataItem, "PostBody")%></p>
</td>
</tr>
<tr>
<td colspan="2">
<div class="post-edit">
<p id="postEditAdmin" runat="server" visible="false"><a class="fancybox.iframe fancybox" href='editpost.aspx?postID=<%#DataBinder.Eval(Container.DataItem, "PostID")%>'>Edit</a> | <asp:LinkButton ID="deleteBtn" runat="server" Text="Delete" CommandName="Delete" OnClientClick="javascript:if(!confirm('Delete this information? this will delete permanently'))return false;" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "PostID")%>' /></p>
<p id="postEdit" runat="server" visible="true"><i>You must be an admin to be able to edit or delete a post</i></p>
</div>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
사람이 저를 거짓으로 진실하고 postEdit.Visible에 postEditAdmin.Visible을 설정하는 방법을 알려 수
? 그것은 페이지로드에서 픽업되지 않습니다.또한 if 문에 따라 변경 될 예정입니다. 이것이 내가 지금까지 가지고있는 것입니다 :
if (Session["role"].ToString() == "2")
{
postEditAdmin.Visible = true;
postEdit.Visible = false;
}
각 태그를 태그로 묶고 여기에 가시성을 설정해보십시오. (나는 그것이 문제를 일으키는 ID와 함께 여러 HTML 서버 컨트롤이 될 수 있다고 생각하고있다.) –
McGarnagle