1
我需要顯示一個登錄鏈接,一旦他們登錄,我需要鏈接顯示爲註銷。隱藏註銷鏈接一旦登錄
這裏是我到目前爲止有:
<div class="account-links">
<a href="<%=Page.ResolveUrl("~/logout.aspx")%>" class="ico-logout">
<%=GetLocaleResourceString("Account.Logout")%></a>
<% if (NopContext.Current.User != null && NopContext.Current.User.IsAdmin)
{ %>
<a href="<%=Page.ResolveUrl("~/administration/")%>" class="ico-admin">
<%=GetLocaleResourceString("Account.Administration")%></a>
<%} %>
</div>
<div class="header-links">
<ul>
<asp:LoginView ID="topLoginView" runat="server">
<AnonymousTemplate>
</AnonymousTemplate>
<LoggedInTemplate>
<li>
<a href="<%= SEOHelper.GetMyAccountUrl()%>" class="account"><%=Page.User.Identity.Name %></a>
<% if (NopContext.Current.IsCurrentCustomerImpersonated)
{
%>
<span class="impersonate">(<%=string.Format(GetLocaleResourceString("Account.ImpersonatedAs"), this.CustomerService.UsernamesEnabled ? Server.HtmlEncode(NopContext.Current.User.Username) : Server.HtmlEncode(NopContext.Current.User.Email))%>
-
<asp:LinkButton runat="server" ID="lFinishImpersonate" Text="<% $NopResources:Account.ImpersonatedAs.Finish %>"
ToolTip="<% $NopResources:Account.ImpersonatedAs.Finish.Tooltip %>" OnClick="lFinishImpersonate_Click"
CssClass="finish-impersonation"></asp:LinkButton>)</span>
<%} %>
</li>
<li></li>
<% if (this.ForumService.AllowPrivateMessages)
{ %>
<li><a href="<%=Page.ResolveUrl("~/privatemessages.aspx")%>" class="ico-inbox">
<%=GetLocaleResourceString("PrivateMessages.Inbox")%></a>
<asp:Literal runat="server" ID="lUnreadPrivateMessages" />
</li>
<%} %>
</LoggedInTemplate>
</asp:LoginView>
如果您使用登錄視圖,它應該自動執行此操作? – Bex
它弄亂了我的CSS,當我用它.. – PD24
它不會搞砸你的CSS,你的CSS是搞砸了 –