Clear button won't clear grid after adding column into it

Hey everyone,

I am adding two columns into Invoice Entry main grid which causes the grid not to clear when user clicks on the Clear icon (Broom). I tried to clear it programmatically inside AfterAdapter method for case “ClearData” or case “ClearList”, none of them works as they even prevent the form from loading.

I add columns using a similar code like this:

Ice.Lib.Framework.EpiUltraGrid ctrl = (Ice.Lib.Framework.EpiUltraGrid)csm.GetNativeControlReference(“fe13awbf-c0sd-4ae4-ad55-ece043bcf3ce”);
DataTable dt = ((DataView)ctrl.DataSource).ToTable();
if (!dt.Columns.Contains(“CPF”))
DataColumn newCol = dt.Columns.Add(“CPF”, typeof(string));
newCol = dt.Columns.Add(“Freight”, typeof(decimal));
ctrl.DataSource = dt.DefaultView;
Then I populate those columns. All works fine except the clear button.

Thanks! Stay safe everyone!

I believe your issue is that you are breaking the EpiMagic.

By manually setting a DataSet instead using a custom EDV (which you can create to load that dt.DefaultView) and setting the EpiBinding, the oTrans has no clue what to do.

///In Initialize
//create a new EpiDataView
EpiDataView edvCustom = new EpiDataView();

//define it as dt.DefaultView;
edvCustom.dataView = dt.DefaultView;

//add it it to oTrans

//set the Epibinding on ctr to MyCustomEDV
after a restart of the form


Hey Chris,

Thanks! I definitely needed to get some rest before implementing this lol I was having a completely wrong approach! Duh!

All I had to do was to add the columns into the edvDataView on InitializeCustomCode as so:


And to populate them after (In a loop):

edvInvcHeadList.dataView.Table.Rows[itr][“CPF”] = …

Thanks a lot for the hint!