当前位置: 代码迷 >> ASP.NET >> %# Eval(getPower()) == "1" ? "显示div'admins'" "隐藏div"%> 如何写 +100
  详细解决方案

%# Eval(getPower()) == "1" ? "显示div'admins'" "隐藏div"%> 如何写 +100

热度:7345   发布时间:2013-02-25 00:00:00.0
%# Eval(getPower()) == "1" ? "显示div'admins'": "隐藏div"%> 怎么写 +100
<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 />
  相关解决方案