背景:
阅读新闻

分类页列表方式修改方法

[日期:2006-05-06] 来源:  作者: [字体: ]

如果你不满足于系统提供的几种列表方式,可以设置列表方式为“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")%>

收藏 推荐 打印 | 录入:木鸟 | 阅读:
相关新闻      
本文评论   [发表评论]   全部评论 (5)
第 5 楼
a 发表于 2008-3-8 11:09:16
新闻URL怎么那么长
第 4 楼
发表于 2007-7-7 12:35:44
文章怎么是顺序排列啊?我想要倒序怎么办?
第 3 楼
ddx 发表于 2007-2-9 14:16:10
作者,点击数,如何显示,,盼回答!!
第 2 楼
nslt 发表于 2006-12-29 9:41:25
管理员 急 为什么我建的模板用这个没办法显示内容?????
第 1 楼
adds 发表于 2006-5-8 7:18:32
太好好,谢谢!
热门评论