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
105
Custom cell data
posted

hi

 im currently have a grid with a DataSource of List<SomeObject>

where SomeObject is difiend like this

class SomeObject

{

int field1 { get; }

int field2 { get; }

SomeOtherObject[ objects { get; }

}

class SomeOtherObject

{

int field3 { get; }

}

where the last property is the same length in all the objects in the list

i would like to make the grid to display each row like that ( columns in the grid )

 field1, field2, and SomeOtherObject[0].field3, SomeOtherObject[1].field3 ..... SomeOtherObject[ n ].field3

 

what i did is to add the extra fields to the band and on initialize row event i wanted to add the cells with the data to each row

but there is no way to add cell. is there a better way of doin what i need?

 

thanks,  moshe

  • 469350
    Verified Answer
    Offline posted

    Hi Moshe,

        There are a lot of ways you can do this.

        The easiest way would be to use the InitializeLayout event of the grid to hide the real column and add an Unbound column to the band.

        Then you use InitializeRow to populate the value of the unbound column's cell. You don't have to add a cell, the cell wil already exist in the row if you add the column. You just have to set it's Value.