0
如何以編程方式將顏色指定給Rad Grid視圖sucn:奇數列獲得一種顏色,偶數coloumns可獲取另一種顏色任何想法。如何根據奇數和偶數以編程方式對radgrid視圖列進行着色根據奇數和偶數
如何以編程方式將顏色指定給Rad Grid視圖sucn:奇數列獲得一種顏色,偶數coloumns可獲取另一種顏色任何想法。如何根據奇數和偶數以編程方式對radgrid視圖列進行着色根據奇數和偶數
請嘗試使用下面的代碼片段。
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;
}
}
}