views:

345

answers:

1

I would like to change behavior of DataColumn.Expression so that when I write:

DataColumn.Expression = "MyMethod(Price)"

it will call MyMethod, pass value from Price column into it and display evaluated value.

How to acomplish this?

+2  A: 

Not possible. The expression parser behind the Expression property is simple and not extensible. Making arbitrary function calls is not one of its capabilities. There are several ways to work around this, especially ones that don't require an expensive reflection lookup. Consider the DataTable.RowChanged event for example.

Hans Passant