janus gridex在运行时改变单元格值?

时间:2013-12-02 16:50:29

标签: c# winforms janus gridex

我需要在运行时更改janus gridex单元格值吗?

例如:

原始单元格值=> 0 运行时单元格值=>允许

此工作在默认datagridview中在事件cellformatting中。 但janus gridex中不存在cellformatting事件

1 个答案:

答案 0 :(得分:5)

使用以下代码:

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

如果row是要更改其单元格值的行,则“ColumnName”:是列Key,ColumnValue是您要为此单元格指定的值

如果要更改FormattingRow事件中的值,请使用以下代码:

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";
     }
}