2

How can I change the backcolor row GridEx(GridJanus) with a condition in c#

thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Pouya
  • 1,908
  • 17
  • 56
  • 78
  • This is not clear enough - can you show us some code?? What have you done so far?? What **condition** do you want to base your decision on?? You need to elaborate a bit more.... – marc_s Dec 10 '11 at 13:22

3 Answers3

5

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);
John Laffoon
  • 2,885
  • 2
  • 26
  • 38
1

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;
            }
        }
    }
Mentor
  • 101
  • 1
  • 8
1
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;
            }
        }
    }
}
Aliaksei Kliuchnikau
  • 13,589
  • 4
  • 59
  • 72
Pouya
  • 1,908
  • 17
  • 56
  • 78