EpiUltraGrid formatting failing

I’m attempting to set the column names and widths on a Base epiUltraGrid in a UD100 Customization. I copied and modified the Code from an existing UD04 Customization in which the column changes work :

		EpiUltraGrid gridPartRevs = ( ( EpiUltraGrid )csm.GetNativeControlReference( "b268a966-22c3-4505-ab20-f87df5d80706" ) );
		UltraGridBand bandPartRevs = gridPartRevs.DisplayLayout.Bands[0];
		bandPartRevs.ColHeaderLines = 3;
		gridPartRevs.DisplayLayout.Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.True;

		gridPartRevs.DisplayLayout.Bands[ 0 ].Columns[ 0 ].Header.Caption = "Part        Class";
		bandPartRevs.Columns[   0 ].Width = 50; // Part Class

This is the Code in the UD100 Customization in which the column names and widths are not affected :

	EpiUltraGrid eugChildListGrid = ( ( EpiUltraGrid )csm.GetNativeControlReference( "87f88dc8-1b94-4324-ba83-583a2af5cbb9" ) );

//	eugChildListGrid.Visible = false;
// Added above line as a test to confirm that the GUID was correct
// When that line is not commented out, the Grid is not visible

	UltraGridBand bndChildListGrid = eugChildListGrid.DisplayLayout.Bands[ 0 ];
	bndChildListGrid.ColHeaderLines = 3;
	eugChildListGrid.DisplayLayout.Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.True;

	eugChildListGrid.DisplayLayout.Bands[ 0 ].Columns[ 0 ].Header.Caption = "Row Type";
	bndChildListGrid.Columns[  0 ].Width = 50; //   Row Type

In both Customizations, the Code is in the same location - the last lines at the end of the UD04Form_Load or UD100Form_Load.

The using statements have also been corrected, adding the lines from the Customization that works to the one that doesn’t :

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.Adapters;
using Ice.BO;
using Ice.Lib;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI;
using Ice.UI.FormFunctions;
// added using statements : 
using Ice.UI.FormFunctions;
using System.Collections.Generic;
using Erp.Adapters;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win.UltraWinDock;

I’ve also added the Assembly References ( Epicor.ServiceModel, Ice.Contracts.BO.DynamicQuery, Ice.Core.Session ) to the UD100 Customization to match the UD04 Customization.

I expect I’m missing something obvious, but can’t spot it. Any sharp eyes out there seeing what I’m not ?

Thanks,

Ken Brunelli

Unrelated but the first line can be rewritten as bndChildListGrid.Columns[ 0 ].Width = 50; // Row Type

First thing to check - are you sure that Column[0] is what you are after? It’s possible Col0 is actually something else that is hidden. Maybe trying printing the column name of 0 to test it

Another option is to get the column by name like Columns[“ColName”]

Finally, are you confident there is only 1 band?

1 Like

Using Columns[ “ColumnName” ] instead of Columns[ 0 ] worked. Plus it’s easier to use the name rather than counting columns.

Thanks, Chris !

2 Likes