<td>
<div id="admin">管理
<%# Eval(getPower()) == "1" ? "显示div'admins'": "隐藏div"%>
<div id="admins">
<asp:LinkButton ID="LinkBtn_delete" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="1">删除</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="2">置顶</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_un_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="3">取消置顶</asp:LinkButton>
</div>
</div>
</td>
------解决方案--------------------------------------------------------
前台
<%# getPower()== "1" ? "显示div'admins'": "隐藏div"%>
后台
public string getPower() { string name = Session["username"].ToString(); string signer = new UserManager().getUserByName(name).U_signer; if (signer == "1") { return "1"; } else{turn "0";} }
------解决方案--------------------------------------------------------
<%if (Eval(getPower()) == "1")
{%>
<div id="admins">
<asp:LinkButton ID="LinkBtn_delete" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="1">删除</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="2">置顶</asp:LinkButton><br />