这种新闻列表要怎么做 像百度找搜资料一样,上面标题,下面一部份内容,我用TABL用一列两行,可是只能添加一条新闻,怎么循环呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <asp:Repeater ID="RepeaterArticlelist" runat="server"><ItemTemplate><table border="0" align="left" cellpadding="0" cellspacing="0"><tr><td height="30" class="title01" align="left"><%=标题%> </td></tr><tr><td height="88" class="text"><%=内容%><br /> </td></tr><tr><td height="20" class="title02"><a href="target="_blank">>> 阅读全文...</a> </td></tr> </table></ItemTemplate></asp:Repeater>可这样写不对... <asp:Repeater ID="RepeaterArticlelist" runat="server"><ItemTemplate><table border="0" align="left" cellpadding="0" cellspacing="0"><tr><td height="30" class="title01" align="left"><%#Eval("标题字段名")%></td></tr><tr><td height="88" class="text"><%#Eval("内容字段名")%><br /> </td></tr><tr><td height="20" class="title02"><a href="target="_blank">>> 阅读全文...</a> </td></tr> </table></ItemTemplate></asp:Repeater> <%#Eval("内容字段名").ToString().Substring(0,10) + "..."%> ++/// 截取字符串并限制字符串长度,多于给定的长度+ /// /// 待截取的字符串 /// 每行的长度,多于这个长度自动换行 /// 输出字符串最大的长度 /// public string CutStr(string str,int len,int max) { string s=""; string sheng=""; if (str.Length >max) { str=str.Substring(0,max) ; sheng=""; } for(int i=0;i 53 { int r= i% len; int last =(str.Length/len)*len; if (i!=0 && i<=last) { if( r==0) { s+=str.Substring(i-len,len)+" "; } } else if (i>last) { s+=str.Substring(i-1) ; break; } } return s+sheng; } 我觉得还是用listview做吧,repeater做分页不好弄啊, <asp:ListView ID="ListView1" runat="server" > <ItemTemplate> <table id="rpt" class="rst_table" border="0" cellpadding="3" style="width: 99%;margin:25px 35px 40px 45px" cellspacing="1"> <tr> <td style="width:300px;"> <a href="Shop.aspx?ShopID=<%# Eval("id") %>"><img src="ShopPic.aspx?PID=<%# Eval("picid") %>" alt="" class="imgrst"/><a> </td> <td style="width:600px;" > <a href="Shop.aspx?ShopID=<%# Eval("id") %>"> <table class="ShopInfo"> <tr> <td> <span><%# Eval("name")%></span> </td> </tr> <tr> <td> <span><%# Eval("shopadd")%></span> </td> </tr> <tr> <td> <span><%# Eval("info")%></span> </td> </tr> </table> <a> </td> </tr> </table> </ItemTemplate> </asp:ListView> i_com = New OracleCommand(str, i_con) Dim l_ada As OracleDataAdapter = New OracleDataAdapter(i_com) Dim l_dt As New DataTable i_con.Open() i_com.ExecuteNonQuery() l_ada.Fill(l_dt) i_con.Close() Dim a As Integer = l_dt.rows.count ListView1.DataSource = l_dt ListView1.DataBind() 先用TABLE做好你排版的方式,再用REPEATER套用 求优化。如何提高 前台加载速度。 急!水晶报表 显示图片问题 各位大侠,我想问个弱弱的问题 错误:不包含脚本里的函数 请问mssql中如何存储图片,又如何显示 为什么我的按扭单击事件第二次的时候不执行 asp.net2.0环境下,通过MapXtreme6.6开发GIS,有时候地图会不显示 水晶报表中如何抑制显示图片? 如何使用Excel.Application,把Dataset导入Excel? 求即时时逝去代码 从数据库读取二进制数据问题,做课程设计遇到的 高手请进,关于JQ跨域调用webservice,给session赋值,然后丢失
<asp:Repeater ID="RepeaterArticlelist" runat="server">
<ItemTemplate>
<table border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td height="30" class="title01" align="left">
<%=标题%> </td>
</tr>
<tr>
<td height="88" class="text">
<%=内容%><br />
</td>
</tr>
<tr>
<td height="20" class="title02">
<a href="target="_blank">>> 阅读全文...</a>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>可这样写不对...
<asp:Repeater ID="RepeaterArticlelist" runat="server">
<ItemTemplate>
<table border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td height="30" class="title01" align="left">
<%#Eval("标题字段名")%></td>
</tr>
<tr>
<td height="88" class="text">
<%#Eval("内容字段名")%><br />
</td>
</tr>
<tr>
<td height="20" class="title02">
<a href="target="_blank">>> 阅读全文...</a>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
///
/// 待截取的字符串
/// 每行的长度,多于这个长度自动换行
/// 输出字符串最大的长度
///
public string CutStr(string str,int len,int max)
{
string s="";
string sheng="";
if (str.Length >max)
{
str=str.Substring(0,max) ;
sheng="";
}
for(int i=0;i 53 {
int r= i% len;
int last =(str.Length/len)*len;
if (i!=0 && i<=last)
{ if( r==0)
{
s+=str.Substring(i-len,len)+"
";
} }
else if (i>last)
{
s+=str.Substring(i-1) ;
break;
} } return s+sheng; }
<table id="rpt" class="rst_table" border="0" cellpadding="3" style="width: 99%;margin:25px 35px 40px 45px"
cellspacing="1">
<tr>
<td style="width:300px;">
<a href="Shop.aspx?ShopID=<%# Eval("id") %>"><img src="ShopPic.aspx?PID=<%# Eval("picid") %>" alt="" class="imgrst"/><a>
</td>
<td style="width:600px;" >
<a href="Shop.aspx?ShopID=<%# Eval("id") %>">
<table class="ShopInfo">
<tr>
<td>
<span><%# Eval("name")%></span>
</td>
</tr>
<tr>
<td>
<span><%# Eval("shopadd")%></span>
</td>
</tr>
<tr>
<td>
<span><%# Eval("info")%></span>
</td>
</tr>
</table>
<a>
</td>
</tr>
</table>
</ItemTemplate> </asp:ListView>
i_com = New OracleCommand(str, i_con)
Dim l_ada As OracleDataAdapter = New OracleDataAdapter(i_com)
Dim l_dt As New DataTable
i_con.Open()
i_com.ExecuteNonQuery()
l_ada.Fill(l_dt)
i_con.Close()
Dim a As Integer = l_dt.rows.count
ListView1.DataSource = l_dt
ListView1.DataBind()