我有以下目标:
我的网站上有一个顶级菜单链接列表
主页 * 链接 * 报价 * 照片
唯一的区别是,每当您在特定页面上时,我希望该页面只是文本(不是 href 链接),而其他页面是链接(以表明这是您所在的页面):
我得到了这个工作,但这样做似乎很糟糕,我正在寻找一种更好的方法来做到这一点:
在我的母版页中,我有以下内容:
<asp:ContentPlaceHolder runat="server" ID="TopMenuLinks">
</asp:ContentPlaceHolder>
在每个单独的页面中,我都有以下内容(这是家谱示例):
家谱看起来像这样:
<asp:Content ID="Content3" ContentPlaceHolderID="TopMenuLinks" runat="server">
<a href="http://xxx/albums.aspx">Photos</a> -
<a href="http://xxx/globe.aspx">Travel</a> -
Family Tree
<a href="http://xxx/wiki.aspx"><spanstyle="color:"#000088">Wiki</span></a> -
<a href="http://xxx/blog.aspx"><span style="color:"#000088">Baby Blog</span></a>
</asp:Content>
照片看起来像这样:
<asp:Content ID="Content3" ContentPlaceHolderID="TopMenuLinks" runat="server">
Photos -
<a href="http://xxx/globe.aspx">Travel</a> -
<a href="http://xxx/globe.aspx">Family Tree</a> -
<a href="http://xxx/wiki.aspx"><spanstyle="color:"#000088">Wiki</span></a> -
<a href="http://xxx/blog.aspx"><span style="color:"#000088">Baby Blog</span></a>
</asp:Content>
如您所见,在每个页面中,我基本上都有与该特定页面不作为链接的重复代码。
有没有更简洁的方法可以做到这一点,而无需在我的每个页面上复制大量代码?
我的样子