我想生成这样的表格:
<table cellspacing="1" cellpadding="0" width="100%" bgcolor="#63747c" border="0">
<tr bgcolor="#f2f2f2">
<td align="center" height="22">日期</td>
<td align="center" height="22">所有视频播放次数</td>
<td align="center" height="22">广告投放次数</td>
</tr>
<---循环体>

<tr bgcolor='#fafafa'><td align='center' height='22'></td><td align='right' height='22'>
        </td><td align='right' height='22'>
            </td></tr><tr bgcolor='#fafafa'><td align='center' height='22'></td><td align='right' height='22'>
                </td><td align='right' height='22'>
                    </td></tr><tr bgcolor='#fafafa'><td align='center' height='22'></td><td align='right' height='22'>
                        </td><td align='right' height='22'>
                            </td></tr>
                            <---循环体>
                            
</table>
用datalist控件生成的都带个table,导致生面的属性框跟下面列出来的数据不能在一个表格里,很难看而且有时候对不齐!!谁有办法解决一下!!不胜感激!!! <table id="DataList1" cellspacing="0" align="center" border="0" style="width:98%;border-collapse:collapse;">
<tr>
<td>
  <tr bgcolor="#fafafa" onMouseOver="this.bgcolor = '#ebebeb'" onMouseOut="this.bgcolor = '#fafafa'">
    <td width="10%" height="20" align="center">test</td>
    <td width="11%" align="center">hndxdd</td>
    <td width="12%" align="center">acc</td>
    <td width="12%" align="center">dd</td>
    <td width="6%" align="center">锁定<input name="Fettle" type="checkbox" value=8 /></td><td width="5%" align="center"><A HREF="#" onclick="topen('Ad.aspx?id=8&Action=Up_App')"><img src="../img/edit.gif" width="15" height="15" border="0"></A></td>
<td width="6%" align="center"><A HREF="Ad.aspx?id=8&Action=Del" onclick="var a=confirm('确定要删除吗?');if(a==0) return(false);"><img src="../img/delete.gif" width="13" height="13" border="0"></A></td> 
  </tr>
  </td>
</tr><tr>
<td>
  <tr bgcolor="#fafafa" onMouseOver="this.bgcolor = '#ebebeb'" onMouseOut="this.bgcolor = '#fafafa'">
    <td width="10%" height="20" align="center">ccxxx</td>
    <td width="11%" align="center">hndxdd</td>
    <td width="12%" align="center">ccc</td>
    <td width="12%" align="center">xxx</td>
    <td width="6%" align="center">锁定<input name="Fettle" type="checkbox" value=7 /></td><td width="5%" align="center"><A HREF="#" onclick="topen('Ad.aspx?id=7&Action=Up_App')"><img src="../img/edit.gif" width="15" height="15" border="0"></A></td>
<td width="6%" align="center"><A HREF="Ad.aspx?id=7&Action=Del" onclick="var a=confirm('确定要删除吗?');if(a==0) return(false);"><img src="../img/delete.gif" width="13" height="13" border="0"></A></td> 
  </tr>
  </td>
</tr><tr>
<td>
  <tr bgcolor="#fafafa" onMouseOver="this.bgcolor = '#ebebeb'" onMouseOut="this.bgcolor = '#fafafa'">
    <td width="10%" height="20" align="center">vvv</td>
    <td width="11%" align="center">hndxdd</td>
    <td width="12%" align="center">ff</td>
    <td width="12%" align="center">sfg</td>
    <td width="6%" align="center">锁定<input name="Fettle" type="checkbox" value=6 /></td><td width="5%" align="center"><A HREF="#" onclick="topen('Ad.aspx?id=6&Action=Up_App')"><img src="../img/edit.gif" width="15" height="15" border="0"></A></td>
<td width="6%" align="center"><A HREF="Ad.aspx?id=6&Action=Del" onclick="var a=confirm('确定要删除吗?');if(a==0) return(false);"><img src="../img/delete.gif" width="13" height="13" border="0"></A></td> 
  </tr>
  </td>
</tr><tr>
<td>
  <tr bgcolor="#fafafa" onMouseOver="this.bgcolor = '#ebebeb'" onMouseOut="this.bgcolor = '#fafafa'">
    <td width="10%" height="20" align="center">测试112</td>
    <td width="11%" align="center">hndxdd</td>
    <td width="12%" align="center">asfd</td>
    <td width="12%" align="center">asdf</td>
    <td width="6%" align="center">锁定<input name="Fettle" type="checkbox" value=5 /></td><td width="5%" align="center"><A HREF="#" onclick="topen('Ad.aspx?id=5&Action=Up_App')"><img src="../img/edit.gif" width="15" height="15" border="0"></A></td>
<td width="6%" align="center"><A HREF="Ad.aspx?id=5&Action=Del" onclick="var a=confirm('确定要删除吗?');if(a==0) return(false);"><img src="../img/delete.gif" width="13" height="13" border="0"></A></td> 
  </tr>
  </td>
</tr><tr>
<td>
  <tr bgcolor="#fafafa" onMouseOver="this.bgcolor = '#ebebeb'" onMouseOut="this.bgcolor = '#fafafa'">
    <td width="10%" height="20" align="center">测试11</td>
    <td width="11%" align="center">hndxdd</td>
    <td width="12%" align="center">啊啊22</td>
    <td width="12%" align="center">啊啊啊</td>
    <td width="6%" align="center">正常<input name="Fettle" type="checkbox" value=3 /></td><td width="5%" align="center"><A HREF="#" onclick="topen('Ad.aspx?id=3&Action=Up_App')"><img src="../img/edit.gif" width="15" height="15" border="0"></A></td>
<td width="6%" align="center"><A HREF="Ad.aspx?id=3&Action=Del" onclick="var a=confirm('确定要删除吗?');if(a==0) return(false);"><img src="../img/delete.gif" width="13" height="13" border="0"></A></td> 
  </tr>
  </td>
</tr>
</table> 

解决方案 »

  1.   

    不知道我说清楚了没有,我想让控件生成的数据列表不带<table>直接循环出来<tr><td>,除了在后台使用Table服务器控件来画表格有没有直接控制控件的方法??
      

  2.   

    别用datagrid
    就自己写html.然后输出来。
      

  3.   

    把数据库的内容粘到一个变量上,然后response.write ???这样太麻烦啊!而且不容易分页!
      

  4.   

    我都是这样做的。分页也简单啊` 一个分页方法,一个输出方法。
    你可以不用response.write
    就把这个变量赋给一个控件。控件可以位置嘛
      

  5.   

    TO:cpp2017(慕白兄)
    用repeater控件可以实现我的要求吗??
      

  6.   

    可以,repeater就是做循环输出用的,它本身不带任何输出的html完全按照用户的定义来写
      

  7.   

    你要那样做,就用Repeater,所有html自己写。
      

  8.   

    你要那样做,就用Repeater,所有html自己写。
      

  9.   

    小弟初练啊,没用过Repeater,哪位大哥给个代码参考一下!!感谢!!
      

  10.   

    <asp:Repeater ID="rp1" runat="server" OnItemCommand="rp1_ItemCommand">
            <HeaderTemplate>
               头部html代码只显示一次 
            </HeaderTemplate>
            <ItemTemplate>
     中间循环代码
              <TR>
              <TD>
                 <%Eval("字段")%>
               </TD>
             </TR>
            </ItemTemplate>
    <FooterTemplate>
    尾部html代码 只显示一次 
    </FooterTemplate>
           </asp:Repeater>