如果你不满足于系统提供的几种列表方式,可以设置列表方式为“DataList绑定”,然后修改分类模板template/list1.aspx中的DataList控件。
默认DataList控件如下:
<asp:DataList id="dlNews"
CellPadding="5"
CellSpacing="0"
GridLines="None"
RepeatColumns="3"
RepeatDirection="Horizontal"
RepeatLayout="Table"
Visible=false
Width="100%"
runat="server">
<ItemStyle CssClass="alignCenterTop"/>
<ItemTemplate>
<%#
LinkImg((System.Data.
DataRowView)
Container.DataItem)%>
<%#LinkTitle((System.Data.
DataRowView)
Container.DataItem)%>
</ItemTemplate>
</asp:DataList>
DataList控件使用方法详见:http://msdn2.microsoft.com/zh-CN/library/9cx2f3ks.aspx
如果你装有.net framework sdk文档请看:ms-help://MS.NETFrameworkSDKv1.1.CHS/cpgenref/html/cpconDataListWebServerControl.htm
ItemTempate中如何显示新闻信息:
新闻标题(带链接): <%#LinkTitle((System.Data.DataRowView)Container.DataItem,40)%>
(其中40为标题长度,可修改)
标题图片(带链接): <%#LinkImg((System.Data.DataRowView)Container.DataItem)%>
新闻日期: <%#FormatTime((DateTime)DataBinder.Eval(Container.DataItem,"dateandtime"))%>
新闻简介: <%#DataBinder.Eval(Container.DataItem,"summary")==DBNull.Value ? IWMS.Utility.WbText.NoHtml((string)DataBinder.Eval(Container.DataItem,"content")): IWMS.Utility.WbText.UrlAddPrefix((string)DataBinder.Eval(Container.DataItem,"summary"),urlPrefix)%>
新闻URL: <%#DataBinder.Eval(Container.DataItem,"aurl")==DBNull.Value ? GetUrlNews((int)DataBinder.Eval(Container.DataItem,"articleid"),(int)DataBinder.Eval(Container.DataItem,"classid"),(DateTime)DataBinder.Eval(Container.DataItem,"dateandtime")): urlPrefix+"trans.aspx?id="+DataBinder.Eval(Container.DataItem,"articleid")%>
RepeatDirection="Horizontal"改为 RepeatDirection="Vertical",新闻可以按垂直顺序排列.
GridLines="None"改为 GridLines="1",每行新闻中间有一条横线分割
GridLines="2"每列新闻之间有一条竖线分割
RepeatColumns="3"表示分几列显示
CellPadding="5" CellSpacing="0"都是表格显示参数