I believe the cast is working. I think what is happening is that the AddNew sets the newPart entity's collection to m_selectedParts, but assigning the DataBoundItem is reseting the entity's collection back to the original, so it is no longer part of m_selectedParts. Try this approach:
Code:
foreach (DataGridViewRow row in kgridParts.SelectedRows)
{
BusinessObjects.Part newPart = new BusinessObjects.Part();
newPart = (BusinessObjects.Part)row.DataBoundItem;
m_selectedParts.AttachEntity(newPart);
}
David Neal Parsons
www.entityspaces.net