UltraGrid Initialize Event Not Fired

Hi,

In the Incoming Intercompany PO Suggestion, I am trying to hide the Unit Price column in UltraGrid under Lines tab and When I am trying to fire the Initialize Event and debug that it is not working fine for your reference code is attached below

EpiUltraGrid grdLines;

public void InitializeCustomCode()
{
grdLines = (EpiUltraGrid)csm.GetNativeControlReference(“acbcfffb-5a30-46e6-9afc-42e99dc732b0”);
this.grdLines.InitializeLayout += new InitializeLayoutEventHandler(this.grdLines_InitializeLayout);
}

public void DestroyCustomCode()
{
this.grdLines.InitializeLayout += new InitializeLayoutEventHandler(this.grdLines_InitializeLayout);
}

private void grdLines_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
	e.Layout.Bands[0].Columns["UnitPrice"].Hidden = true;
}

anyone can suggest?

Your line in DestroyCustom Code should be a -, not a +.

You should hide it via extended properties. There is a wizard for that.

I have done the below mentioned changes in DestroyCustomCode but getting same issue

public void DestroyCustomCode()
{
this.grdLines.InitializeLayout -= new InitializeLayoutEventHandler(this.grdLines_InitializeLayout);
}

First comment wasn’t a fix, just a comment on being a good dev :smiley: