这个最好的实现方法就是用response.write的方法以表格嵌套的形式把你想要的格式输出来

解决方案 »

  1.   

    嗯,可以用GridView的TemplateField模板嵌套GridView
      

  2.   

    可以把两个GridView上下并排放置  然后设置它的滚动条属性
      

  3.   

    赞同Thunder_li 的 用模板嵌套gridview 完全可以做到LZ的功能要求
      

  4.   

    发个DataList控件嵌套的例子给你看看
    http://hi.baidu.com/honghu3000/blog/item/6f7dc6603bd674da8db10db4.html
      

  5.   

    如果lz是vs2003就用DataList或Repeter
      

  6.   

     <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                                                                BorderStyle="None" BorderWidth="0px" OnPageIndexChanging="GridView1_PageIndexChanging"
                                                                                PageSize="4" Width="475px">
                                                                                <Columns>
                                                                                    <asp:TemplateField ShowHeader="False">
                                                                                        <ItemTemplate>
                                                                                            <table cellpadding="0" cellspacing="0" style="width: 475px; margin-bottom: 10px;">
                                                                                                <tr>
                                                                                                    <td bgcolor="#C8C8C8" colspan="3" height="10">
                                                                                                        &nbsp;</td>
                                                                                                </tr>
                                                                                                <tr>
                                                                                                    <td style="width: 100px" valign="top" align="center" class="t2">
                                                                                                        <%#DataBinder.Eval(Container.DataItem,"ncd_adddate") %>
                                                                                                    </td>
                                                                                                    <td rowspan="3" style="width: 10px" valign="top">
                                                                                                        <img height="36" src="images/index_9.gif" width="10" /></td>
                                                                                                    <td>
                                                                                                        <asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" BorderStyle="None"
                                                                                                            BorderWidth="0px" DataSource='<%# ((System.Data.DataRowView)(Container.DataItem)).CreateChildView("newscontentdetail") %>'
                                                                                                            GridLines="Horizontal" PageSize="10" ShowHeader="False" Width="90%">
                                                                                                            <Columns>
                                                                                                                <asp:TemplateColumn>
                                                                                                                    <ItemTemplate>
                                                                                                                        <table border="0" cellpadding="0" cellspacing="0" width="395">
                                                                                                                            <tr>
                                                                                                                                <td width="8">
                                                                                                                                </td>
                                                                                                                                <td style="height: 19px; width: 50px;"  class="STYLE1">
                                                                                                                                    <%#DataBinder.Eval(Container.DataItem,"ncd_adddate","{0:MM.dd}") %>
                                                                                                                                </td>
                                                                                                                                <td style="height: 19px; width: 337px;" align="left">
                                                                                                                                    <a target="_blank" href="LhNews/NewsDetails.aspx?newsid=<%#((System.Data.DataRowView)Container.DataItem)["id"] %>"><%#((System.Data.DataRowView)Container.DataItem)["ncd_title"] %></a>
                                                                                                                                </td>
                                                                                                                            </tr>
                                                                                                                        </table>
                                                                                                                    </ItemTemplate>
                                                                                                                </asp:TemplateColumn>
                                                                                                            </Columns>
                                                                                                            <PagerStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                                                                                                Font-Underline="False" HorizontalAlign="Right" NextPageText="Next" PrevPageText="Prev" />
                                                                                                        </asp:DataGrid></td>
                                                                                                </tr>
                                                                                            </table>
                                                                                        </ItemTemplate>
                                                                                        <ItemStyle VerticalAlign="Top" Width="150px" />
                                                                                        <HeaderStyle Width="150px" />
                                                                                    </asp:TemplateField>
                                                                                </Columns>
                                                                            </asp:GridView>主要是红色部分。
    后台:
    private void getf_sinfo()
        {//获取主从明细信息根据时间
            string strsql = "select distinct convert(varchar(7),ncd_adddate,120) as ncd_adddate from newscontentdetails order by ncd_adddate desc;select top 10 id, ncd_title,convert(varchar(7),ncd_adddate,120) as adddate,ncd_adddate from newscontentdetails group by ncd_adddate,ncd_title,id order by ncd_adddate desc";
            DataSet ds = DB.backdataset(strsql);
            ds.Tables[0].TableName = "bigtable";
            ds.Tables[1].TableName = "smalltable";
            DataColumn dcbig = ds.Tables["bigtable"].Columns["ncd_adddate"];
            DataColumn dcsmall = ds.Tables["smalltable"].Columns["adddate"];
            DataRelation drlation = new DataRelation("newscontentdetail",dcbig,dcsmall,false);
            ds.Relations.Add(drlation);
            GridView1.DataSource = ds.Tables["bigtable"].DefaultView;
            this.GridView1.DataBind();
        }
    一定能满足你的、不行,再给我留言。