Hi Experts,
I tried searching epiusers for “how to delete rows from DataView” and did not find anything.
I am trying to delete Order Misc Charges (OHOrderMsc) in Order Entry UI Customization. I have tried below code in various formats and nothing worked. I have also tried setting RowMod to “D”, but no luck.
private void DeleteFRGT()
{
bool updt= false;
EpiDataView edvOHMisc= (EpiDataView)oTrans.EpiDataViews[“OHOrderMsc”];
foreach(DataRow dr in edvOHMisc.dataView.Table.Rows)
{
if(dr[“MiscCode”].ToString() == “FRT”)
{
dr.Delete();
updt= true;
}
}
if(updt == true) {
oTrans.Update();
oTrans.Refresh();
}
}
Also tried below:
DataRow rows = edvOHMisc.dataView.Table.Select();
for(int i = 0; i < rows.Length ; i++)
{
edvOHMisc.dataView.Table.Rows[i].BeginEdit();
edvOHMisc.dataView.Table.Rows[i][“RowMod”] = “D”;
edvOHMisc.dataView.Table.Rows[i].EndEdit();updt= true;
}
Reaching out to the community for help.
Thanks, SK.