asp.net中的Datalist控件

时间:2009-09-25 09:01:01

标签: asp.net

在我的网络应用程序中,我正在使用datalist,因为我正在显示图像,而我正在显示该图像的名称。我正在水平显示图像并显示5行图像。我的问题是由于图像名称的长度很长,单元格之间的空间很大。我们可以在第二行显示名称。

如果你不明白我的问题,请帮助告诉我,我会再次解释。

这是源代码

<asp:DataList ID="DataList1" RepeatColumns="9" RepeatDirection="Horizontal" 
     runat="server" Width="719px" >
   <ItemTemplate>
     <center>
       <img src='AlumniGallery/compressed/<%# Eval("Photoname")%>' id="img1" 
           width="75px" height="85px"/><br />           
       <asp:LinkButton ID="LinkButton1" ForeColor="black" CssClass="xyz" 
           Width="165px" CommandArgument='<%# Eval("Photoname")%>'  
           CommandName='<%# Eval("slno")%>' runat="server" 
           OnCommand="LinkButton2_Command"><%# Eval("name")%></asp:LinkButton>
     </center> </ItemTemplate>
</asp:DataList>

1 个答案:

答案 0 :(得分:1)

尝试使用:

  <ItemStyle Width="100px" Wrap="true" /> //this will limit width of the 
                                          //item and wrap long text
  <ItemTemplate>