DataList限制字符个数,多出的用 ......
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
foreach (DataListItem dt in this.DataList1.Items)
{
{
foreach (DataListItem dt in this.DataList1.Items)
{
Label lb = (Label)e.Item.FindControl("Label1");
string Test1 = lb.Text;
string lbtest1 = "";
if (Test1.Length > 8)
{
lbtest1 = Test1.Substring(0, 8);
lb.Text = lbtest1 + "......";
}
else
{
lb.Text = Test1.ToString();
}
}
}