GridView绑定小技

1,使用表达式。如下,缺货的产品用红色,别的绿色。

image

image

实际上,就这个表达式:

(Int32)Eval("Num")<(Int32)Eval("MinNum")?System.Drawing.Color.Red:System.Drawing.Color.Green

2,属性成员。这是产品订购记录,有产品编号ProductID,扩展属性Product,单位在产品类中。

image

image

注意Product.UnitName那里

原文地址:https://www.cnblogs.com/nnhy/p/2065198.html