Customization Grid - Colorize Cell

I can colorize a row in a Grid based on the value of a cell in that row with a row rule, similar to a DashBoard but in C# :

	private void CreateRowRuleMtlSugDNBTypeNum_cEquals_2( )
		RuleAction errorMtlSug_RowAction = RuleAction.AddRowSettings( this.oTrans, "MtlSug", false, SettingStyle.Error );
		RuleAction[ ] ruleActions = new RuleAction[ ] {   errorMtlSug_RowAction   };

		RowRule rrCreateRowRuleMtlSugDNBTypeNum_cEquals_2 = new RowRule( "MtlSug.DNBTypeNum_c", RuleCondition.Equals, 2, ruleActions );
		( ( EpiDataView )( this.oTrans.EpiDataViews[ "MtlSug" ] ) ).AddRowRule( rrCreateRowRuleMtlSugDNBTypeNum_cEquals_2 );
	} //   end CreateRowRuleMtlSugDNBTypeNum_cEquals_2( )

Is it possible to colorize just that cell, instead of the entire row ?


Ken Brunelli

dgv.Rows[0].Cells[0].Appearance.BackColor = Color.Red;

If you set the RowActino to be field only and not Row it should do just that one field.

1 Like

If you set BackColor manually, you’ll probably need to ensure that UseAppStyling = false;

I’m getting an error when attempting to compile : ‘Ice.Lib.ExtendedProps.RuleAction’ does not contain a definition for ‘AddFieldSettings’

I’ve checked the Business Logic Method Call Wizard to see if there is a Field Method, but I don’t see Ice.Lib.ExtendedProps listed there.

How would I set the RowAction to be field only ?



Complete stab in the dark. Try calling the following and pass the epiBinding name of the field?

	public static RuleAction AddControlSettings(EpiDataView epiDataView, string epiBinding, SettingStyle style)