日期:2014-05-18  浏览次数:20479 次

关于datalist问题
<asp:DataList ID="DataList1" runat="server" RepeatColumns="4" RepeatDirection="Horizontal">
  <HeaderTemplate>
  <table width="688" border="0" cellpadding="0" cellspacing="0">
  <tr>
  </HeaderTemplate>
  <ItemTemplate>
  <td width="172" height="150" align="center" valign="top><img src="" width="130" height="104" border="0" style="border:1px #ccc solid;"/><br />
  </a></td>
  </ItemTemplate>
  <FooterTemplate>
  </tr>
  </table>
  </FooterTemplate>
  </asp:DataList>
   
  我用datalist横向显示数据,每行4个,可是当只有俩个图片时,这俩个图片并不是挨着的,而是中间有一搭块空白,我想当只有俩个图片时这俩个图片都在中间显示,而不是一个在头一个在尾

------解决方案--------------------
取消宽度设置,width删了
  
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 

http://feiyun0112.cnblogs.com/
------解决方案--------------------
不要指定表格的宽度