I am trying to customize a EpiUltraGrid that we have on the order entry screen.
I am trying to add a new column with a database value which would read from a field called SalesDescription_c which is in the parts table as an extended ud field.
I have managed to add the column in and set a static value via
But now i want this to be dynamic and all of my efforts so far have failed.
The custom code from the script editor can be seen below:
I have tried various options found via Google and commented them out in the code.
I am desperate to get this sorted ASAP, i'm rather new to C# in general so if you need any more information please let me know.
I am trying to add a new column with a database value which would read from a field called SalesDescription_c which is in the parts table as an extended ud field.
I have managed to add the column in and set a static value via
Code:
e.Row.Cells.Value = "String Here";
The custom code from the script editor can be seen below:
I have tried various options found via Google and commented them out in the code.
Code:
// **************************************************
// Custom code for SalesOrderForm
// Created: 16/01/2015 16:33:34
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Erp.Adapters;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
private EpiBaseAdapter oTrans_partAdapter;
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
Ice.Lib.Framework.EpiUltraGrid myGrid;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.oTrans_partAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT\\["oTrans_partAdapter"\\]));
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
SetExtendedProperties();
// End Wizard Added Custom Method Calls
myGrid = (Ice.Lib.Framework.EpiUltraGrid)csm.GetNativeControlReference("bec51417-b286-4d61-a471-3912bc098905");
myGrid.DisplayLayout.Bands\\[0\\].Columns.Add("SalesDescription_c","Sales Description");
myGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
}
private void grdMatLst_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
EpiDataView salesDesc = (EpiDataView)(this.oTrans.EpiDataViews\\["Stock"\\]);
//PartAdapter myOrderAdapt = new PartAdapter(this.oTrans);
//myOrderAdapt.BOConnect();
//salesDesc.dataView.Table.Rows\\["PartNum"\\];
foreach(DataRowView drV in salesDesc.dataView.Table.Rows)
{
object sValue = drV\\["SalesDescription_c"\\];
//int pNum = salesDesc.dataView.Table.Rows\\[0\\];
e.Row.Cells\\["SalesDescription_c"\\].Value = sValue.ToString();
}
//e.Row.Cells\\["SalesDescription_c"\\].Value = salesDesc.dataView.Table.Rows\\["SalesDescription_c"\\];
//e.Row.Cells\\["SalesDescription_c"\\].Value = "pNum";
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void SetExtendedProperties()
{
// Begin Wizard Added EpiDataView Initialization
EpiDataView edvOrderDtl = ((EpiDataView)(this.oTrans.EpiDataViews\\["OrderDtl"\\]));
// End Wizard Added EpiDataView Initialization
// Begin Wizard Added Conditional Block
if (edvOrderDtl.dataView.Table.Columns.Contains("PartNum"))
{
// Begin Wizard Added ExtendedProperty Settings: edvOrderDtl-PartNum
edvOrderDtl.dataView.Table.Columns\\["PartNum"\\].ExtendedProperties\\["ZoneBAQ"\\] = "CustomSalesEntrySearch";
edvOrderDtl.dataView.Table.Columns\\["PartNum"\\].ExtendedProperties\\["ZoneSearchOnEmptyControl"\\] = true;
// End Wizard Added ExtendedProperty Settings: edvOrderDtl-PartNum
}
// End Wizard Added Conditional Block
}
}