I'm a newbie with devexpress. When I work with gridview in it I have a problem :
private void grdItem_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
{
ReceiveController _rc = new ReceiveController();
DataRow r = null;
int[] selectedRows = grdItem.GetSelectedRows();
if (selectedRows.Length != 0)
{
for (int i = 0; i < selectedRows.Length; i++)
{
grdItem.GetDataRow(selectedRows[i]);
// Set cell properties here
}
}
}
In event selectionchanged a row, i need set a few cells properties in it, may be : bordercolor, allowedit = false, or disable..... But I don't know how I can do ?
You cannot set appearance properties for a specific cell like that. The GridControl does not maintain an internal collection of rows/columns, so it's not as easy as just saying Grid.Rows[3].Cells[2].BackColor = Color.Blue;.
Instead, you need to handle one of the GridView's drawing events; in this case, it would seem that the RowCellStyle event would be the best choice.
Typically, within the RowCellStyle event handler you will check to see if the current cell meets a specific condition based on a rule. If so, you can then apply formatting to that cell.