I have a C# app using the Infragistics ultragrid in a Winforms solution. I need to do the following and I am unsure how after trolling through these forums.
1) currently when the grid is show on my form (using data binding) there is a row highlighted. I would like to have nothing at all highlighted in the grid (or active) when the user first comes to it
2) I need to check the value in a column on a per row basis (before displaying the grid to the user). If that row contains a certain value, then I need to change the background color for that whole row.
2) I need to check the value in a column on a per row basis. If that row contains a certain value, then I need to effectively disable this row. I am not allowing user edits on any of the data so editing is not a concern. I don't want them to be able to select this row at all. So if they try it simply ignores them (maybe supply a messagebox or something at the time too).
Is there an easy way to do this? I am spinning my wheels here. Thanks!
skinpounder said:1) currently when the grid is show on my form (using data binding) there is a row highlighted. I would like to have nothing at all highlighted in the grid (or active) when the user first comes to it
skinpounder said:2) I need to check the value in a column on a per row basis (before displaying the grid to the user). If that row contains a certain value, then I need to change the background color for that whole row. 2) I need to check the value in a column on a per row basis. If that row contains a certain value, then I need to effectively disable this row. I am not allowing user edits on any of the data so editing is not a concern. I don't want them to be able to select this row at all. So if they try it simply ignores them (maybe supply a messagebox or something at the time too).
In this event, take a look at the value of a particular cell in the row, and change the row's color. For instance, assuming the grid has a boolean "ShowAsRed" coulmn:
if ((bool) e.Row.GetCellValue("ShowAsRed") == true) e.Row.Appearance.BackColor = Color.Red;else e.Row.Appearance.BackColor = Color.Empty; // Resets to the "default" color
Likewise, take a look at a different cell, and disable or enable the row based on that value. For instance, assuming the same grid has a boolean "Enabled" column:
if ((bool) e.Row.GetCellValue("Enabled") == false) e.Row.Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;else e.Row.Activation = Infragistics.Win.UltraWinGrid.Activation.Disabled; // or use Activation.NoEdit or Activation.ActivateOnly if you don't want to use a "disabled" appearance
Hi,
in InitializeRow I have this code but the background color of the rows never change. I even forced the color without any condition and it still not changing.
private void ugdResult_InitializeRow(object sender , InitializeRowEventArgs e){ Color NewColor = decimal.Parse(e.Row.Cells["Psu_AMOUNT_PAID"].Value.ToString()) < 0 ? Color.Red : Color.FromArgb(0 , 0 , 0 , 0); e.Row.Appearance.BackColor = NewColor;}