Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
525
AddNewRowCell in CellExitedEditMode
posted

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.

Parents
No Data
Reply
  • 6475
    posted

    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,

Children