像百度找搜资料一样,上面标题,下面一部份内容,
我用TABL用一列两行,可是只能添加一条新闻,怎么循环呢?

解决方案 »

  1.   


    <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">&gt;&gt; 阅读全文...</a>
     </td>
    </tr>
     </table>
    </ItemTemplate>
    </asp:Repeater>可这样写不对...
      

  2.   


    <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">&gt;&gt; 阅读全文...</a>
     </td>
    </tr>
     </table>
    </ItemTemplate>
    </asp:Repeater>
      

  3.   

    <%#Eval("内容字段名").ToString().Substring(0,10) + "..."%>
      

  4.   

    ++/// 截取字符串并限制字符串长度,多于给定的长度+ 
    /// 
    /// 待截取的字符串 
    /// 每行的长度,多于这个长度自动换行 
    /// 输出字符串最大的长度 
    /// 
    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; }
      

  5.   

    我觉得还是用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()
      

  6.   

    先用TABLE做好你排版的方式,再用REPEATER套用