public void productsGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int unitsInStock = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "UnitsInStock"));
if (unitsInStock == 0)
e.Row.BackColor = Color.Yellow;
}
}
gridview中的数据进行特殊的显示
最新推荐文章于 2025-11-08 09:54:25 发布
本文介绍了一段C#代码,用于在ASP.NET中为GridView控件的数据行设置背景颜色。当产品的库存单位为0时,该代码将对应行的背景颜色设置为黄色。
1万+

被折叠的 条评论
为什么被折叠?



