Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何以编程方式将颜色分配给 Rad Grid 视图 sucn 奇数列获得一种颜色,偶数列获得另一种颜色,任何想法都可以。
请尝试以下代码片段。
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; if (item.ItemIndex % 2 == 0) { item.BackColor = System.Drawing.Color.Red; } } }