UD100 BeforeAdapter Delete (Header/Detail)

When I use the BeforeAdapter on the UD100 table, is there a way to tell me if the user is deleting the header or a detail item? I see there is only one adapter for UD100 and not the UD100A. I am running this code to iterate through the lines but when they just delete one line I only want to process it for that one detail record. I realize this will need to be conditioned for that but can’t differentiate through the adapter if a header or a line is being deleted. The rowmods are blank on both in my messagebox unless I am calling that incorrectly.

	private void oTrans_adapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
	{
		switch (args.MethodName)
		{
			case "Delete":
				//MessageBox.Show(edvUD100.dataView[edvUD100.Row]["RowMod"].ToString() + " / " + edvUD100A.dataView[edvUD100A.Row]["RowMod"].ToString());
				if(edvUD100A.dataView.Count > 0)
				{
					foreach(DataRowView rowView in edvUD100A.dataView)
					{
						DataRow row = rowView.Row;
						int no = 0;
						if(int.TryParse(row["ChildKey2"].ToString(), out no) && int.TryParse(row["ChildKey1"].ToString(), out no))
						{
							int bolNum = Convert.ToInt32(row["ChildKey2"]);
							deleteBOL(bolNum, packNum);
						}
					}
				}
				refreshGrids();
				break;
		}

	}

Thanks,
Ross

You should be able to get a hold of the Adapter data itself and iterate through the list and look at the RowState

var adapter = (UD100Adapter)csm.TransAdaptersHT["oTrans_adapter"];
foreach(var x in adapter.UD100Data.UD100)
{
    if(x.RowState == DataRowState.Deleted
}
foreach(var x in  adapter.UD100Data.UD100A)
{
   if(x.RowState == DataRowState.Deleted
}

note I just typed this in here from memory so the syntax may not be exact but you get the idea.

Excellent, thanks Jose! I will give that a try and no problem on memory stuff…I can sort out the details.

Regards,
Ross

I tried this and get ‘Unchanged’ for everything when I delete the header or any line.

var adapter = (UD100Adapter)csm.TransAdaptersHT["oTrans_adapter"];
foreach(DataRow row in adapter.UD100Data.UD100)
{	
	MessageBox.Show(row.RowState.ToString());
}
foreach(DataRow row in  adapter.UD100Data.UD100A)
{
	MessageBox.Show(row.RowState.ToString());
}

Not sure if I am doing anything wrong here and will keep looking but thought I would report back.

Thanks,
Ross