foreach (DataRow row in table.Rows)
{
ListItem item = new ListItem();
if (row["PC_State1"].ToString() == "0")
{
item.Attributes.Add("style", "color:black;");
item.Attributes.Add("style", "height:50px;");
}
else
{
item.Attributes.Add("style", "color:red;");
}
item.Text = row["PC_Name"].ToString().Trim();
item.Value = row["PC_ID"].ToString();
ListBox1.Items.Add(item);
}
评论