Cs Tip12: 简单的站底

译自: http://soup.co.za/weblog/archive/2006/04/02/CS-Tip-12_3A00_-Simple-Sitewide-Footers.aspx

在Cs Tip02(中文, 英文)中我们介绍了简单的站点头部,现在我们来介绍怎样做一个简单的站点底部

Cstip12

查看Demo

Cs中有一个非常有用的Genernic Control可以来包含我们我Footer, 你可以简单的修改
控件地址: <CS:GenericControl SkinName = "Foo.ascx" runat = "Server" />


您要先打开Themes/default./skins/Skin-GenericControl.ascx.另存为Skin-CustomFooter.ascx

插入代码

<div class="customfooterright">
<CS:RepeaterBar ID="RepeaterBar2" runat="server">
<SkinTemplate>
<asp:Repeater EnableViewState="false" runat="server" id="Menu">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li><a href="<%# DataBinder.Eval(Container.DataItem, "NavigateUrl") %>"><%# DataBinder.Eval(Container.DataItem, "Text") %></a></li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</SkinTemplate>
</CS:RepeaterBar>
<p>Terms and Conditions Apply. We own all your data</p>
</div>

如果您要在每个页面都加上这个控件,还需要在Themes/default/Masters/Master.ascx 中添加

<CS:MPRegion id="BodyFooterRegion" runat="server" >
<CS:GenericControl SkinName = "Skin-CustomFooter.ascx" runat="Server" id="CustomFooter1" />
<CS:Footer runat="server" id="Footer1"/>
</CS:MPRegion>

Css文件:

修改Common.Css, 这个修改对应的Master.ascx对应的ID样式

#CommonFooter{
color: #FFF;
font-size: 11px;
text-align: left;
background-color: #333;
padding: 8px 20px 8px 20px;
}

#CommonFooter a{
color: #FFF;
}

这个修改Skin-CustomFooter.ascx

.customfooterright{
text-align: right;
float: right;

}
.customfooterright ul {
margin: 0;
padding: 0;
list-style: none;
}

.customfooterright li {
display: inline;
margin: 0;
padding: 0 0 0 10px;
}

ok 刷新一下页面就可以看到对应的效果了

posted on 2006-08-08 19:34  xwang  阅读(401)  评论(2编辑  收藏  举报

导航