EpiDataView to Datatable

Dear Team,

can you pls help me how to convert epidataview to datatable in customization script.

you need to elaborate more pal, explain what you want to do with examples and if you done any work then share it with as much clarifications as you can

Dear @A.Baeisa,

I tried to bind the last value of ebicombo box in page load in Job Receive to Salvage page. I tried to lot of ways but i couldn’t binding. the below code for you reference.

Code:

// **************************************************
// Custom code for RcptToSalForm
// Created: 15/12/2020 13:18:27
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using System.Collections;
using System.Collections.Generic;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using Ice.BO;
using Ice.UI;
using System.ComponentModel;

public class Script
{
// ** Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! **
// Begin Wizard Added Module Level Variables **

private EpiDataView edvPartTran;
private decimal Qty = 0;
private string JobNumber = string.Empty;
private EpiDataView edvselectView;
private EpiDataView edvDone;
private EpiBaseAdapter oTrans_jMtlAdapter;
private EpiBaseAdapter oTrans_jobAdapter;
// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

public void InitializeCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
	// Begin Wizard Added Variable Initialization

	this.edvPartTran = ((EpiDataView)(this.oTrans.EpiDataViews["PartTran"]));
	this.edvPartTran.EpiViewNotification += new EpiViewNotification(this.edvPartTran_EpiViewNotification);
	this.edvselectView = ((EpiDataView)(this.oTrans.EpiDataViews["selectView"]));
	this.edvselectView.EpiViewNotification += new EpiViewNotification(this.edvselectView_EpiViewNotification);
	this.edvDone = ((EpiDataView)(this.oTrans.EpiDataViews["Done"]));
	this.edvDone.EpiViewNotification += new EpiViewNotification(this.edvDone_EpiViewNotification);
	this.oTrans_jMtlAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_jMtlAdapter"]));
	this.oTrans_jMtlAdapter.AfterAdapterMethod += new AfterAdapterMethod(this.oTrans_jMtlAdapter_AfterAdapterMethod);
	this.oTrans_jobAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_jobAdapter"]));
	this.oTrans_jobAdapter.AfterAdapterMethod += new AfterAdapterMethod(this.oTrans_jobAdapter_AfterAdapterMethod);
	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	this.uCmbMtl.BeforeDropDown += new System.ComponentModel.CancelEventHandler(this.uCmbMtl_BeforeDropDown);
	this.cmbTSt.BeforeDropDown += new System.ComponentModel.CancelEventHandler(this.cmbTSt_BeforeDropDown);
	this.cmbTSt.AfterDropDown += new System.EventHandler(this.cmbTSt_AfterDropDown);
	// End Wizard Added Custom Method Calls
}

public void DestroyCustomCode()
{
	// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
	// Begin Wizard Added Object Disposal

	this.edvPartTran.EpiViewNotification -= new EpiViewNotification(this.edvPartTran_EpiViewNotification);
	this.edvPartTran = null;
	this.edvselectView.EpiViewNotification -= new EpiViewNotification(this.edvselectView_EpiViewNotification);
	this.edvselectView = null;
	this.edvDone.EpiViewNotification -= new EpiViewNotification(this.edvDone_EpiViewNotification);
	this.edvDone = null;
	this.uCmbMtl.BeforeDropDown -= new System.ComponentModel.CancelEventHandler(this.uCmbMtl_BeforeDropDown);
	this.cmbTSt.BeforeDropDown -= new System.ComponentModel.CancelEventHandler(this.cmbTSt_BeforeDropDown);
	this.cmbTSt.AfterDropDown -= new System.EventHandler(this.cmbTSt_AfterDropDown);
	this.oTrans_jMtlAdapter.AfterAdapterMethod -= new AfterAdapterMethod(this.oTrans_jMtlAdapter_AfterAdapterMethod);
	this.oTrans_jMtlAdapter = null;
	this.oTrans_jobAdapter.AfterAdapterMethod -= new AfterAdapterMethod(this.oTrans_jobAdapter_AfterAdapterMethod);
	this.oTrans_jobAdapter = null;
	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

private void RcptToSalForm_Load(object sender, EventArgs args)
{
	
	//string PartNumber = string.Empty;
	// Add Event Handler Code
	if(RcptToSalForm.LaunchFormOptions !=null)
	{

		string[] lfoOptions = (string[])RcptToSalForm.LaunchFormOptions.ContextValue;
		Qty = Convert.ToDecimal(lfoOptions[0].ToString());
		JobNumber = lfoOptions[1].ToString();

		//view.dataView[args.Row]["PartTran.JobNum"] = Qty;
		//view.dataView[args.Row]["PartTran.ActTranQty"] = JobNumber;

		//MessageBox.Show("Context Value: " + lfoOptions[0].ToString() + "\nContext Value: " + lfoOptions[1].ToString());	
		//oTrans.GetNewJobAsmblMultiple("SVG-STK","RcptToSalEntry");
		
		//((DataTable)cmbTSt.DataSource).DefaultView.Sort = "MtlSeq desc";
		//oTrans.OnChangeAsmSeq();
		//oTrans.GetByID(JobNumber);

		oTrans.GetNewAfterAssm(JobNumber, 0);
		EpiDataView edvJobRcv = (EpiDataView)(oTrans.EpiDataViews["PartTran"]);
		System.Data.DataRow edvJobRcvRow = edvJobRcv.CurrentDataRow;
		DataTable dt = new DataTable();  

		//Erp.UI.Controls.Combos.JobMtlSearchCombo cmbMtlSeq = (Erp.UI.Controls.Combos.JobMtlSearchCombo)csm.GetNativeControlReference("3c29bb2b-cc78-4cab-80c8-f004923fdbae");
		
		//int count = cmbMtlSeq.Items.Count;
		//MessageBox.Show(cmbMtlSeq.Items.Count.ToString());

		//cmbMtlSeq.PerformAction(Infragistics.Win.UltraWinGrid.UltraComboAction.Dropdown);
		//MessageBox.Show(cmbMtlSeq.Rows.Count.ToString());

		/*string[] strSpecArrayForTopics = new string[cmbMtlSeq.Items.Count];
		int k = 0;
		foreach (ListItem li in cmbMtlSeq.Items)
		{
		
		    strSpecArrayForTopics[k] = li.Value;
		    lblSpec.Text = lblSpec.Text + "<br />" + li.Value;
		    k++;
		}*/

// PartTran.JobSeq
//edvJobRcv.dataView[edvJobRcv.Row][“ActTranQty”] = 10;
if(edvJobRcvRow != null)
{
edvJobRcvRow.BeginEdit();
edvJobRcvRow[“ActTranQty”] = Decimal.Parse(lfoOptions[0].ToString());
//edvJobRcv.Sort = “JobSeq DESC”;
//EpiDataView edvUD103A = ((EpiDataView)(this.oTrans.EpiDataViews[“PartTran”]));
//System.Data.DataRow edvJobRcvRow1 = edvUD103A.CurrentDataRow;

			//dt = edvJobRcvRow["JobSeq"].ToString();

			//for (int i=0; i<= edvJobRcv.dataView.Table.Rows.Count-1; i++)
			//for(int i=0; i< cmbMtlSeq.Rows.Count; i++)
			
			/*foreach(DataRow item in cmbMtlSeq.Rows)
			{
				//edvUD103A.BeginEdit();
				//string key1 = edvJobRcv.dataView.Table.Rows[i]["Key1"].ToString();
				//edvJobRcvRow["JobSeq"] = edvUD103A.dataView.Table.Rows[i]["JobSeq"].ToString();
				//edvUD103A.EndEdit();
				MessageBox.Show(cmbMtlSeq.Rows.Count.ToString());
			}*/
			
			
			//edvJobRcvRow["JobSeq"] = edvJobRcvRow["MtlSeq"];
			
			/*List<string> textFields = new List<string>();
            foreach (ListItem item in cmbMtlSeq.) 
			{
            	textFields.Add(item.Text);
        	}*/

			/*string[] arrItems = new string[cmbTSt.Items.Count];
		    if (cmbTSt.Items.Count > 0)
		    {
		        for (int i = 0; i < cmbTSt.Items.Count; i++)
				//for (int i = 0; i < cmbTSt.Length; i++)
		        {
		            arrItems[i] = cmbTSt.Items[i].ToString();
		        }
		    }*/

			//SearchOnJobMtlSearchAdapterShowDialog(JobNumber);
			
			/*for(int i=0; i<= edvJobRcvRow["MtlSeq"];i++)
			{					
			}*/
			
			//cmbMtlSeq.SortStyle = Infragistics.Win.ValueListSortStyle.DescendingByValue;
			//cmbMtlSeq.EpiSort = ValueListSortStyle.AscendingByValue;
			//cmbMtlSeq.EpiSort = "MtlSeq";
			//cmbMtlSeq.SortStyle = Infragistics.Win.ValueListSortStyle.DescendingByValue;
			//((DataTable)cmbMtlSeq.DataSource).DefaultView.Sort = "JobSeq desc";
			//((DataTable)cmbMtlSeq.DataSource).DefaultView.SortStyle = "MtlSeq DESC";
			//cmbMtlSeq.SelectedIndex = cmbMtlSeq.Items.Count -1;
			//edvJobRcvRow["JobSeq"] = "JobSeq ASC";
			//DataView dataView = new DataView(edvJobRcvRow.dataView.Table);
			//dataView.Sort = "JobSeq DESC";
			//((DataTable)cmbMtlSeq.DataSource).DefaultView.Sort = "JobSeq desc";
			//((DataTable)cmbMtlSeq.DataSource).DefaultView.Sort = "JobSeq desc";
			//edvJobRcvRow["JobSeq"].EpiSort = "JobSeq desc";
			
			//cmbMtlSeq.DisplayLayout.Bands[0].Columns["JobSeq"].SortIndicator = SortIndicator.Ascending;
			//((DataTable)cmbMtlSeq.DataSource).DefaultView.Sort = "PartTran.JobSeq desc";
			//SearchOnPartTranAdapterShowDialog(JobNumber);
			//edvJobRcvRow["JobNum"] = lfoOptions[1].ToString();
			//edvJobRcvRow["JobSeq"] = 30;				
			//edvJobRcvRow.dataView[edvJobRcvRow.Row]["JobSeq"] = "30";
			edvJobRcvRow.EndEdit();
		}
		//oTrans.Update();

		/*System.Data.DataRow edvJobRcv = jobedv.CurrentDataRow;
		if(edvJobRcv != null)
		{
			MessageBox.Show("111");
			edvJobRcv.BeginEdit();
			edvJobRcv["ActTranQty"] = Qty;
			edvJobRcv["JobNum"] = JobNumber;
			edvJobRcv.EndEdit();
		}*/

		/*if (jobedv.dataView.Table.Columns.Contains("ActTranQty") && jobedv.dataView.Table.Columns.Contains("JobNum"))
		{
			jobedv.dataView[jobedv.Row]["ActTranQty"] = 001;
			jobedv.dataView[jobedv.Row]["JobNum"] = "002";
		}*/

		
		
		//edvJobRcv.dataView[edvJobRcv.Row]["ActTranQty"] = 10;
		//edvJobRcv.dataView[edvJobRcv.Row]["JobNum"] = "00017";
	}
	
	/*if(RcptToSalForm.LaunchFormOptions !=null)
	{
    	EpiDataView edvCustomView = (EpiDataView)RcptToSalForm.LaunchFormOptions.ContextValue;
    	if(edvCustomView !=null)
    	{
			string Param = RcptToSalForm.LaunchFormOptions.ContextValue.ToString();
			char[] delimiterChars = {'~'};
			string[] SplitParam = Param.Split(delimiterChars);
			if (SplitParam.Length != 0)
			{
				MessageBox.Show("2");
				MessageBox.Show("Part Number - " + Convert.ToString(SplitParam[0]));
				MessageBox.Show("Job Number - " + Convert.ToString(SplitParam[1]));
				PartNumber = Convert.ToString(SplitParam[0]);
				JobNumber = Convert.ToString(SplitParam[1]);

				edvCustomView.dataView[edvCustomView.Row]["PartNum"] = "001";
				edvCustomView.dataView[edvCustomView.Row]["JobNum"] = "002";
			}
    	}
	}*/

	if (RcptToSalForm.LaunchFormOptions != null)
	{			
		
		/*MessageBox.Show("1");
		string Param = RcptToSalForm.LaunchFormOptions.ContextValue.ToString();
		char[] delimiterChars = {'~'};
		string[] SplitParam = Param.Split(delimiterChars);

		if(SplitParam != null)
		{
			MessageBox.Show("2");
			MessageBox.Show(SplitParam[0].ToString());
			MessageBox.Show(SplitParam[1].ToString());

			//EpiDataView reqedv = (EpiDataView)(oTrans.EpiDataViews["PartTran"]);

			//edvPartTran.dataView[edvPartTran.Row]["ActTranQty"] = Convert.ToInt32(SplitParam[0].ToString());
			//edvPartTran.dataView[edvPartTran.Row]["JobNum"] = Convert.ToString(SplitParam[1]);
			//Qty = Convert.ToInt32(SplitParam[0]);
			//JobNumber = Convert.ToString(SplitParam[1]);
		}*/
		//EpiDataView reqedv = (EpiDataView)(oTrans.EpiDataViews[“MoveRequest”]);
		//reqedv.dataView[reqedv.Row]["JobNum"] = jobnumbertext;

/* object o = RcptToSalForm.LaunchFormOptions.ValueIn;
string[] values = (string[])o;

		EpiDataView edvReportParams = (EpiDataView)oTrans.EpiDataViews["PartTran"];

		MessageBox.Show(values[0].ToString());
		MessageBox.Show(values[1].ToString());

/
//edvReportParams.dataView[edvReportParams.Row][“ActTranQty”] = values[0];
//edvReportParams.dataView[edvReportParams.Row][“JobNum”] = values[1];
/

EpiDataView edv = ((EpiDataView)(this.oTrans.EpiDataViews[“PartTran”]));
//System.Data.DataRow edvMainRow = edv.CurrentDataRow;
//DataRow edv = ((EpiDataView)oTrans.EpiDataViews[“PartTran”]).CurrentDataRow;

		string Param = RcptToSalForm.LaunchFormOptions.ContextValue.ToString();
		char[] delimiterChars = {'~'};
		string[] SplitParam = Param.Split(delimiterChars);

		if (SplitParam.Length != 0)
		{
			//EpiDataView edv = ((EpiDataView)(this.oTrans.EpiDataViews["PartTran"]));		
			//System.Data.DataRow edvJobRcv = edv.CurrentDataRow;
			
			//if ((edvMainRow != null))
			//{
				MessageBox.Show("2");
				MessageBox.Show("Qty - " + Convert.ToString(SplitParam[0]));
				MessageBox.Show("Job Number - " + Convert.ToString(SplitParam[1]));

				Qty = Convert.ToInt32(SplitParam[0]);
				JobNumber = Convert.ToString(SplitParam[1]);

				edv.dataView[edv.Row]["PartTran.ActTranQty"] = SplitParam[0];
				edv.dataView[edv.Row]["PartTran.JobNum"] = SplitParam[1];

				MessageBox.Show("Part Number - " + Qty);
				MessageBox.Show("Job Number - " + JobNumber);

*/
/*edvOrderHed.dataView[edvOrderHed.Row][“PONum”] = PartNumber;
edvOrderHed.dataView[edvOrderHed.Row][“PONum”] = JobNumber;

				edvMainRow["PartNum"] = PartNumber;
				edvMainRow["JobNum"] = JobNumber;
				edvMainRow.BeginEdit();
				edvMainRow["JobNum"] = Convert.ToString(SplitParam[0]);
				edvMainRow["PartNum"] = Convert.ToString(SplitParam[1]);
				edvMainRow.EndEdit();*/
			//}

			//edv["JobNum"] = Convert.ToString(SplitParam[0]);
			//edv["PartNum"] = Convert.ToString(SplitParam[1]);
			//rmAReceipt = Convert.ToInt32(SplitParam[2]);
			//MessageBox.Show(JobNumber.ToString());
			//MessageBox.Show(Qty.ToString());
		//}

		/*Ice.Lib.Framework.EpiCombo cmbMtlSeq = (Ice.Lib.Framework.EpiCombo)csm.GetNativeControlReference("3c29bb2b-cc78-4cab-80c8-f004923fdbae");
		cmbMtlSeq.PerformAction(Infragistics.Win.UltraWinGrid.UltraComboAction.Dropdown);
		MessageBox.Show(cmbMtlSeq.Rows.Count.ToString());*/
		
		Ice.Lib.Framework.EpiUltraCombo cbo = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("3c29bb2b-cc78-4cab-80c8-f004923fdbae");
		cbo.PerformAction(Infragistics.Win.UltraWinGrid.UltraComboAction.Dropdown);
		MessageBox.Show(cbo.Rows.Count.ToString());		
		cbo.Value = cbo.Rows[2].Cells[0].Value.ToString();
		Ice.Lib.Framework.EpiTextBox txt = (Ice.Lib.Framework.EpiTextBox)csm.GetNativeControlReference("432333da-f7e6-4330-a60b-fe847ca47620");
		txt.Focus();
	}
}

private void edvPartTran_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	// ** Argument Properties and Uses **
	// view.dataView[args.Row]["FieldName"]
	// args.Row, args.Column, args.Sender, args.NotifyType
	// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
	//MessageBox.Show(args.NotifyType.ToString());
	if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
	{			
		if ((args.Row > -1))
		{
			if(RcptToSalForm.LaunchFormOptions != null)
			{
				//MessageBox.Show("Inti Flag");
				//oTrans.Refresh();
				/*Ice.Lib.Framework.EpiUltraCombo cbo = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("3c29bb2b-cc78-4cab-80c8-f004923fdbae");
				cbo.PerformAction(Infragistics.Win.UltraWinGrid.UltraComboAction.Dropdown);
				MessageBox.Show(cbo.Rows.Count.ToString());		
				cbo.Value = cbo.Rows[2].Cells[0].Value.ToString();
				Ice.Lib.Framework.EpiTextBox txt = (Ice.Lib.Framework.EpiTextBox)csm.GetNativeControlReference("432333da-f7e6-4330-a60b-fe847ca47620");
				txt.Focus();*/
				/*EpiDataView edvJobRcv = (EpiDataView)(oTrans.EpiDataViews["PartTran"]);
				System.Data.DataRow edvJobRcvRow = edvJobRcv.CurrentDataRow;
				if(edvJobRcvRow != null)
				{
					((DataTable)cmbTSt.DataSource).DefaultView.Sort = "MtlSeq desc";
				}*/
			}
			//MessageBox.Show("Try");
			//((DataTable)cmbTSt.DataSource).DefaultView.Sort = "MtlSeq desc";
			/*MessageBox.Show("Try");
			if(RcptToSalForm.LaunchFormOptions != null)
			{
				string[] lfoOptions = (string[])BAQReportForm.LaunchFormOptions.ContextValue;
				orderNum = lfoOptions[0];
				lineNum = lfoOptions[1];
				relNum = lfoOptions[2];

				string[] lfoOptions = (string[])RcptToSalForm.LaunchFormOptions.ContextValue;
				Qty = Convert.ToDecimal(lfoOptions[0].ToString());
				JobNumber = lfoOptions[1].ToString();

				//view.dataView[args.Row]["PartTran.JobNum"] = Qty;
				//view.dataView[args.Row]["PartTran.ActTranQty"] = JobNumber;

				MessageBox.Show("Context Value: " + lfoOptions[0].ToString() + "\nContext Value: " + lfoOptions[1].ToString());
				//char[] delimiterChars = {'~'};
				//string[] SplitParam = Param.Split(delimiterChars);

			// MessageBox was for testing purposes only.
			// MessageBox.Show("Context Value: " + lfoOptions[0] + "\nContext Value: " + lfoOptions[1] + "\nContext Value: " + lfoOptions[2]);
			}*/
		}
	}
}


private void edvselectView_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	// ** Argument Properties and Uses **
	// view.dataView[args.Row]["FieldName"]
	// args.Row, args.Column, args.Sender, args.NotifyType
	// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
	//MessageBox.Show(args.NotifyType.ToString() + "123");
	if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
	{
		if ((args.Row > -1))
		{
			//MessageBox.Show("Catch");
		}
	}
}


private void edvDone_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
	// ** Argument Properties and Uses **
	// view.dataView[args.Row]["FieldName"]
	// args.Row, args.Column, args.Sender, args.NotifyType
	// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
	// MessageBox.Show(args.NotifyType.ToString());
	if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
	{
		//MessageBox.Show("222");
		if ((args.Row > -1))
		{
			//MessageBox.Show("333");
		}
	}
}

private void CallReceiptsFromMfgAdapterGetNewJobAsmblMultipleMethod(string pcTranType, string pcProcessID)
{
	try
	{
		// Declare and Initialize EpiDataView Variables
		// Declare and create an instance of the Adapter.
		ReceiptsFromMfgAdapter adapterReceiptsFromMfg = new ReceiptsFromMfgAdapter(this.oTrans);
		adapterReceiptsFromMfg.BOConnect();

		// Declare and Initialize Variables
		// TODO: You may need to replace the default initialization with valid values as required for the BL method call.

		// Call Adapter method
		bool result = adapterReceiptsFromMfg.GetNewJobAsmblMultiple(pcTranType, pcProcessID);

		// Cleanup Adapter Reference
		adapterReceiptsFromMfg.Dispose();

	} catch (System.Exception ex)
	{
		ExceptionBox.Show(ex);
	}
}

private void CallReceiptsFromMfgAdapterGetNewJobAsmblMultipleMethod()
{
	try
	{
		// Declare and Initialize EpiDataView Variables
		// Declare and create an instance of the Adapter.
		ReceiptsFromMfgAdapter adapterReceiptsFromMfg = new ReceiptsFromMfgAdapter(this.oTrans);
		adapterReceiptsFromMfg.BOConnect();

		// Declare and Initialize Variables
		// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
		string pcTranType = String.Empty;
		string pcProcessID = String.Empty;

		// Call Adapter method
		bool result = adapterReceiptsFromMfg.GetNewJobAsmblMultiple(pcTranType, pcProcessID);

		// Cleanup Adapter Reference
		adapterReceiptsFromMfg.Dispose();

	} catch (System.Exception ex)
	{
		ExceptionBox.Show(ex);
	}
}

private void SearchOnPartTranAdapterShowDialog(string JobNum)
{
	// Wizard Generated Search Method
	// You will need to call this method from another method in custom code
	// For example, [Form]_Load or [Button]_Click
	
	/*Erp.UI.Controls.Combos.JobMtlSearchCombo cmbMtlSeq = (Erp.UI.Controls.Combos.JobMtlSearchCombo)csm.GetNativeControlReference("3c29bb2b-cc78-4cab-80c8-f004923fdbae");
	bool recSelected;
	string whereClause = "PartTran.JobNum = '"+ JobNum +"'";
	System.Data.DataSet dsAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "JobMtlSearchAdapter", out recSelected, false, whereClause);
	if (recSelected)
	{
		// Set EpiUltraCombo Properties
		this.cmbMtlSeq.ValueMember = "MtlSeq";
		this.cmbMtlSeq.DataSource = dsAdapter;
		this.cmbMtlSeq.DisplayMember = "MtlSeq";
		string[] fields = new string[] {
				"MtlSeq"};
		this.cmbAttribute.SetColumnFilter(fields);
	}*/
}

private void SearchOnJobMtlSearchAdapterShowDialog(string JobNumber)
{
	// Wizard Generated Search Method
	// You will need to call this method from another method in custom code
	// For example, [Form]_Load or [Button]_Click

	bool recSelected;
	string whereClause = "JobMtl.JobNum = '"+ JobNumber +"'";
	System.Data.DataSet dsAttributAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "JobMtlSearchAdapter", out recSelected, false, whereClause);
	if (recSelected)
	{
		// Set EpiUltraCombo Properties
		this.cmbTSt.ValueMember = "MtlSeq";
		this.cmbTSt.DataSource = dsAttributAdapter;
		this.cmbTSt.DisplayMember = "MtlSeq";
		string[] fields = new string[] {
				"MtlSeq"};
		this.cmbTSt.SetColumnFilter(fields);
	}

	/*bool recSelected;
	string whereClause = "JobNum = '"+ JobNumber +"'";
	System.Data.DataSet dsJobMtlSearchAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "JobMtlSearchAdapter", out recSelected, true, whereClause);
	if (recSelected)
	{
		System.Data.DataRow adapterRow = dsJobMtlSearchAdapter.Tables[0].Rows[0];

		// Map Search Fields to Application Fields
		EpiDataView edvPartTran = ((EpiDataView)(this.oTrans.EpiDataViews["PartTran"]));
		System.Data.DataRow edvPartTranRow = edvPartTran.CurrentDataRow;
		if ((edvPartTranRow != null))
		{
			edvPartTranRow.BeginEdit();
			edvPartTranRow["JobSeq"] = adapterRow["MtlSeq"];
			edvPartTranRow.EndEdit();
		}
	}*/
}

private void uCmbMtl_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
{
	// ** Place Event Handling Code Here **
	//((DataTable)uCmbMtl.DataSource).DefaultView.Sort = "Description desc";
}

private void cmbTSt_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
{
	// ** Place Event Handling Code Here **
	/*EpiDataView edvSugPoDtl = ((EpiDataView)(this.oTrans.EpiDataViews["JobMtl"]));
	System.Data.DataRow edvSugPoDtlRow = edvSugPoDtl.CurrentDataRow;
	if(edvSugPoDtlRow!=null)
	{
		edvSugPoDtlRow.BeginEdit();
		edvSugPoDtlRow["JobSeq"]=dtPO.Rows[i]["MtlSeq"].ToString();
		edvSugPoDtlRow.EndEdit();
	}*/		
	((DataTable)cmbTSt.DataSource).DefaultView.Sort = "MtlSeq desc";
}

private void cmbTSt_AfterDropDown(object sender, System.EventArgs args)
{
	// ** Place Event Handling Code Here **
	//((DataTable)cmbTSt.DataSource).DefaultView.Sort = "MtlSeq desc";
} 

private void oTrans_jMtlAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
	// ** Argument Properties and Uses **
	// ** args.MethodName **
	// ** Add Event Handler Code **

	// ** Use MessageBox to find adapter method name
	// EpiMessageBox.Show(args.MethodName)
	switch (args.MethodName)
	{
		case "Update":
			break;
	}

}

private void oTrans_jobAdapter_AfterAdapterMethod(object sender, AfterAdapterMethodArgs args)
{
	// ** Argument Properties and Uses **
	// ** args.MethodName **
	// ** Add Event Handler Code **

	// ** Use MessageBox to find adapter method name
	EpiMessageBox.Show(args.MethodName);
	switch (args.MethodName)
	{
		case "Update":
			break;
	}

}

}

Current Output:
0
30
40

Expected Output:

40
30
0

Hey @IsaiSelvan, I’ve got 2 posts for you to read that’s going to help you out immensely here.

	Reference de current data table from a EpiDataView
	this._edvOrderDtl = ((EpiDataView)(this.oTrans.EpiDataViews["OrderDtl"]));
	DataTable dtOrderDtl = this._edvOrderDtl.dataView.Table;

	or Clone

	DataTable dtOrderDtl = this._edvOrderDtl.dataView.Table.Clone();