Hi,
I'm having some problems retrieving the value of a cell in the CellExitedEditMode event using the AddNewRowFeature.
Value's of a cell that have a column which key is linked to a field in my business object on the first level are retrieved correctly (eg executorFullName below, e.Cell.Value contains a string) <igGrid:TextColumn IsSortable="False" IsFixed="Left" HeaderText="Executor" Key="executorFullName" />
However: values's of a cell that have a column which key is linked to a fied in my business object on the second level are not retrieved correctly (it is null)
<igGrid:TextColumn IsSortable="False" IsFixed="Left" HeaderText="Home Base" Key="oHomeBase.description" />
e.Cell.Value of oHomeBase.description is null.
Regular editing of existing records on my grid works perfectly. The above scenario only occurs when using AddNewRow.
Are you sure your oHomeBase object is not null?
If you have fields in your business object, that represent some complex objects, you'll have to make sure they are not null when you're adding a new row using AddNewRow. To be more clear on that, I'll try to explain it this way:
Let's say your grid is bound to a list of objects of type "MyDataObject" and MyDataObject has a property, called "oHomeBase", which is of type "HomeBase". Now, let's say that "HomeBase" is a complex type which has a property , called "description". And, you bound one of the grid's columns to this "description" property with the syntax you described above.
So, when you add a new row, using the AddNewRow feature, it will create a new object of type MyDataObject for you, to add to the data source. But it's up to you to make sure that the "oHomeBase" property is not null, in order to set the "description" on it.
One way to hande this is to make this "oHomeBase" property read-only and handle it like this:
oHomeBase
{
get
if (this._oHomeBase == null)
this._oHomeBase = new HomeBase();
}
return this._oHomeBase;
Hope that helps,
Hi Georgi,
I understand what you are saying.
Problem is that I don't know where the "MyDataObject" object is initialised when it is used on AddNewRow.
If I debug into CellExitedEditMode when placing values into cells of a new row, e.Cell.Value is indeed filled for properties of the object that are not initialised on null.
Something additional I can mention is that "oHomeBase" is of a type of a Linq-to-SQL class. I don't know how I can make that it doesn't initialise on null.