另用CSS 來達成 HTML文字自動截斷

//==HTML文字自動截斷...
string divCSS = "width: 400px; text-overflow: ellipsis; overflow: hidden; white-space:nowrap;";
strbody += "<table width='100%' border='0' cellspacing='0' cellpadding='3'>";

while (!rs.Read())
{
  strbody += "<tr>";
  strbody += "        <td width='4%'> </td>";
  strbody += "        <td width='4%' valign='top'><img src='../Images/icon-05.gif' /></td>";
  strbody += "        <td width='96%'><div style='" + divCSS + "'>" +rs["id"].ToString() + "</div></td>";
  strbody += "        <td width='4%'> </td>";
  strbody += "    </tr>";
  rs.MoveNext();
}
strbody += "</table>"

留言