回复 2# kevintang 的帖子
不好意思,刚才没说清楚.我是用DataList然后到数据库取数据,你看以下面的代码:
<table style="width: 470px; height: 170px">
<tr>
<td rowspan="2" style="width: 180px; height: 170px">
</td>
<td style="width: 290px; height: 25px; background-image: url(images/290.jpg);">
新闻资讯</td>
</tr>
<tr>
<td style="width: 290px; height: 145px; vertical-align: text-top;">
<asp:DataList ID="dlnews" runat="server">
<ItemTemplate>
<asp:Label ID="lblnews" runat="server" Text=""><a href="daohang.ascx?newsID=<%#Eval("newsID") %>"><%#Eval("newsname") %></a></asp:Label>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
代码页是:
string sqlstr = Convert.ToString(ConfigurationManager.ConnectionStrings["sqlserver"]);
SqlConnection conn = new SqlConnection(sqlstr);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from news order by newstime desc",conn);
DataSet ds = new DataSet();
da.Fill(ds);
dlnews.DataSource = ds;
dlnews.DataBind();
因为表的宽度我想固定,而其中一条数据很长,所以不的不省略号.麻烦帮我看看,谢谢......