DEV--GerdView控件

1.遍历

for (int i = 0; i < gridView1.RowCount; i++)
{
       for (int j = 0; j < gridView1.Columns.Count; j++)
       {
             object val = gridView1.GetRowCellValue(i, gridView1.Columns[j]);
       }
}

 

2.为某行设置背景色

 private void gridView1_RowStyle(object sender, RowStyleEventArgs e)
        {
            GridView View = sender as GridView;

            if (e.RowHandle >= 0)
            {
                string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["允许打印"]);

                if (category == "")
                {
                    e.Appearance.BackColor = Color.Salmon; e.Appearance.BackColor2 = Color.SeaShell;
                }
            }
        }

 

 

你可能感兴趣的:(view)