use nested DataList, following the exampleHOW TO: Display Hierarchical Data by Using Nested Repeater Controls and Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;306154but use DataList and set RepeatDirection="Horizontal" RepeatColumns="2" for the outer DataList

解决方案 »

  1.   

    给你段程序,你改改
    <asp:DataList id="dl2" runat="server" Width="100%" RepeatDirection="Horizontal" RepeatColumns="2" ShowFooter="False" ShowHeader="False">
    <ItemTemplate>
    <table cellspacing="0" cellpadding="5" width="220" border="0">
    <tr>
    <td align="center" width="90"><a href='more.aspx?id=<%# DataBinder.Eval(Container.DataItem, "id") %>'><img 
                                    src='wmg/<%# DataBinder.Eval(Container.DataItem, "simg") %>' 
                                    border=0 width="86" height="73"></a></td>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" height="40">
    <tr align="left" valign="top">
    <td><span class="title3"><%# DataBinder.Eval(Container.DataItem, "name") %></span><span class="title3"></span></td>
    </tr>
    </table>
    <span class="title3"> 价格:<font color="#fb6a21">¥<%# DataBinder.Eval(Container.DataItem, "price") %><br>
    <br>
    <a href='addware.aspx?id=<%# DataBinder.Eval(Container.DataItem, "id") %>'><img src="img/cart.gif" width="79" height="17" border="0"></a>
    </font></span></td>
    </tr>
    </table>
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
    <tr>
    <td width="1" background="img/digi_dot4.gif"><img height="2" src="img/digi_dot4.gif" width="1"></td>
    </tr>
    </table>
    </ItemTemplate>
    </asp:DataList>
      

  2.   

    如下图的样式
    http://bbs.dvbbs.net/UploadFile/2004-4/200442901029372.gifbitsbird(一瓢.net) 兄,我想要cs内容,谢谢
    谢谢回复的几位大哥
      

  3.   

    asp中用RecordSet,ASP.NET中可以用的对象很多,给你个DataReader的例子sql="select type from 分类"; 
    SqlCommand objCommand = new SqlCommand(sql,conn);
    SqlDataReader objDataReader = objCommand.ExecuteReader();
    while(objDataReader.Read())
    {
        type=objDataReader["分类名称"].ToString();
        sql2="select * from 文章 where 文章分类='"+type+"'"; 
        SqlCommand objCommand2 = new SqlCommand(sql2,conn);
        SqlDataReader objDataReader2 = new objCommand.ExecuteReader();
        while(objDataReader2.Read())
            Response.Write(type);
    }
      

  4.   

    sql="select type from 分类" 
    rs.open (sql,conn,1,1) 
    do while not rs.eof 
    type=rs("分类名称").value sql2="select * from 文章 where 文章分类='"&type&'" 
    rs2.open (sql2.conn,1,1 )
    do while not rs2.eof
    Response.Write( type)
    rs2.movenext 
    loop 
    rs.movenext 
    loop