How can I change the backcolor row GridEx(GridJanus) with a condition in c#
thanks
How can I change the backcolor row GridEx(GridJanus) with a condition in c#
thanks
I can't link to it directly, but I found this in a post by Ravi Kota on the Janus Systems forums. I'm not able to test this at present and it is an older post... Conceptually it looks right though.
GridEXFormatCondition fc;
fc = new GridEXFormatCondition(GridName.RootTable.Columns[ColumnName], ConditionOperator.GreaterThan, 0);
fc.FormatStyle.ForeColor = Color.Blue;
GridName.RootTable.FormatConditions.Add(fc);
On LoadingRow event format row:
private void MyGridEX_LoadingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
{
if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record)
{
if ((bool)e.Row.Cells[0].Value)
{
Janus.Windows.GridEX.GridEXFormatStyle style = new Janus.Windows.GridEX.GridEXFormatStyle();
style.ForeColor = Color.Red;
e.Row.RowStyle = style;
}
}
}
private void Grd_Detail_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
{
int i = 1;
for (i = 0; i < Grd_Detail.RowCount; i++)
{
string s = Grd_Detail.GetRow(i).Cells["FN"].Value.ToString();
if (s == "True")
{
if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record)
{
Janus.Windows.GridEX.GridEXFormatStyle rowcol = new GridEXFormatStyle();
rowcol.BackColor = Color.LightGreen;
Grd_Detail.GetRow(i).RowStyle = rowcol;
}
}
}
}