Using colours in grids cells
Highlighting complete rows
The method .displayOption() method on a form datasource can be over-ridden to control the appearance of an single row in a grid. It is possible to set the background or foreground (text) colour.
public void displayOption(Common _record, FormRowDisplayOption _options)
{
_options.backColor(WinApi::RGB2int(255,255,0)); // Yellow
}
Highlighting individual grid cells
To highlight one or more individual cells, use the ._options.affectedElementsByControl() method to limit the effect to only the cells in which you are interested.
Note that while this method can display the same colour in multiple cells, there is no way to display different colours in a single row.
public void displayOption(Common _record, FormRowDisplayOption _options)
{
_options.backColor(WinApi::RGB2int(255,255,0)); // Yellow
_options.affectedElementsByControl(Control_Name.id());
_options.affectedElementsByControl(Another_Control_Name.id());
}
1 comment:
Hi, great post! However, this code works great for manipulating color in win grids. What I want is to use it in WebGrid's. Is it at all possible??
Please help!!!!
Post a Comment