janus gridex change cell value at runtime?

Mostafa picture Mostafa · Dec 2, 2013 · Viewed 8.2k times · Source

I need to change janus gridex cell value at runtime ?

for example :

original cell value => 0 runtime cell value => allow

This work in default datagridview In the event cellformatting . but not exist cellformatting event in the janus gridex

Answer

Adel Khayata picture Adel Khayata · Dec 4, 2013

Use the following code:

grid.Row = row;
grid.SetValue("ColumnName", ColumnValue );

Where row is the row that you want to change its cell's values, "ColumnName": is the column Key and ColumnValue is the value you want to assign for this cell

If you want to change the value in the FormattingRow event, use the following code:

private void gridProject_FormattingRow(object sender, RowLoadEventArgs e)
{
    string s = e.Row.Cells["Status"].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;
            e.Row.RowStyle = rowcol;
        }

        e.Row.Cells["Status"].Text = "yes";
     }
     else
     {
          e.Row.Cells["Status"].Text = "no";
     }
}