Wednesday, March 2, 2011

RepeatControls troubles - solution repeatControls

I've struggled more or less a working day trying to figure out why all of the properties I passed to a Custom Control inside a Repeat Control got nullified.

In afterPageLoad, in the Custom Control, I tried binding the compositeData values to a private variable for later use. I tried a lot of ways of making the properties survive, but whatever I tried, they ended up as null values before I could get a hold of them.

Components inside the control could "read" the composite data, but when the life cycle got as far as scripting, the values were nullified. The solution it turns out is setting the property repeatControls on the Repeat Control to true. I guess this results in a less agressive trash collector(?).

Anyways, my recommendation to IBM is to default set the option to true, unless the performance hit is big. I bet I'm not the only developer that has struggled/will struggle with this strange behaviour.