Women in Technology

Hear us Roar

  Using Calculated DataColumns in ADO.NET
Subject:   Parent/Child Expressions
Date:   2003-06-16 10:34:30
From:   anonymous2
Have you ever explored using calculated columns that traverse DataRelations in order to display data? I'm currently having a blocking issue with this that I cannot resolve.

I have two DataTables. One is a lookup table that contains an ID and a description. The other contains other data as well as a reference to the lookup table. I have a DataRelation set between the two tables and I have added a calculated column using the following expression:


When I first load this data to the DataGrid the expression works fine. It also works well when I add new data. However, anytime I attempt to perform an update to any column in the table, even if it has nothing to do with that relation, I get a prompt (not an Exception) that states the following:

Error when committing the row to the original data source.
There is no Proposed data to access. Do you want to correct the value?

I've seen a method proposed by Microsoft which involves creating a custom DataGridColumnStyle and Painting the related data at runtime while bound to a blank column but this doesn't support sorting.