如果你不滿足于系統(tǒng)提供的幾種列表方式,可以設(shè)置列表方式為“DataList綁定”,然后修改分類模板template/list1.aspx中的DataList控件。 默認(rèn)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文檔請(qǐng)看:ms-help://MS.NETFrameworkSDKv1.1.CHS/cpgenref/html/cpconDataListWebServerControl.htm ItemTempate中如何顯示新聞信息: 新聞標(biāo)題(帶鏈接): <%#LinkTitle((System.Data.DataRowView)Container.DataItem,40)%> 標(biāo)題圖片(帶鏈接): <%#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"都是表格顯示參數(shù) |
聯(lián)系客服