Grid Row Formatting

I have this dynamic query which runs after a button click.

	DynamicQueryAdapter dqaATT = new DynamicQueryAdapter(oTrans);
		dqaATT.BOConnect();
		QueryExecutionDataSet qedsATT = dqaATT.GetQueryExecutionParametersByID("GS_Customer_Attributes_Search");
		qedsATT.ExecutionParameter.Clear();
		qedsATT.ExecutionParameter.AddExecutionParameterRow("Attribute", BAQComboAttributeDropdown.Text , "nvarchar", false, Guid.NewGuid(), "ATT");
		dqaATT.ExecuteByID("GS_Customer_Attributes_Search", qedsATT);
		gridAttributesSales.DataSource = dqaATT.QueryResults.Tables["Results"];
		

I want the row to be red if the column [“Calculated_TotalTouches”] = 0

I’ve used something like this before to format a column but I’m unsure of how to get my request above coded: //gridAttributesSales.DisplayLayout.Bands[0].Columns[“OrderDtl_GS_LineTotalPrice_c”].Format = “###,##0.00”;

Look at the initialize row event off the ultra grid

1 Like
private void InitializeRow(object sender , InitializeRowEventArgs e)
{
  //logic to determine if this row qualifies here....
  e.Row.Appearance.BackColor = NewColor;
}

You should create a customization for your dashboard assembly and use the row rules wizard. It will automatically add the code you need following Epicor’s best practices.

3 Likes

Okay so how do I write the part for determining if this row qualifies?

“e” refers to the current row so you’ll want to get the Cell which holds your value in that row and check it against your condition.



	private void gridAttributesSales_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs args)
	{
		if (["Calculated_TotalTouches"].SalesAttributes.Row.Value == 0) 
					{
						SalesAttributes.Row.Appearance.BackColor = Color.Red;
					}	
		
	}

I have this so far but it isn’t compiling

If(args.Row.Cells[“Calculated_TotalTouches”].Value = 0)

	private void gridAttributesSales_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs args)
	{
				SalesAttributes = (EpiUltraGrid)csm.GetNativeControlReference("734456b7-1448-419b-87f8-f2c950d63cc2");
		if (args.Row.Cells["Calculated_TotalTouches"].Value.ToString() == "0") 
					{
						SalesAttributes.Row.Appearance.BackColor = Color.Red;
					}	
		
	}
	

Okay that line compiles but now I have an issue with the last line…

I got it, duh!

private void gridAttributesSales_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs args)
{
			SalesAttributes = (EpiUltraGrid)csm.GetNativeControlReference("734456b7-1448-419b-87f8-f2c950d63cc2");
	if (args.Row.Cells["Calculated_TotalTouches"].Value.ToString() == "0") 
				{
					args.Row.Appearance.BackColor = Color.Red;
				}	
	
}

args.Row.Appearance.BackColor = Color.Red;

Beat me to it.

1 Like

Agreed.

I am trying to use this same code in an Epicor Form Invoice Entry. The exact same code will not compile.

That just seems like you are missing using statement for System.Drawing