[resolved]Repeater problem
Hi!
Im using a Repeater control to display a collection of data. The data is fetched from the db as an collection of objects and bound to the repeater. As the repeater is rendered it fires the itemdatabound event which I catch to further manipulate the controls I have put in the template for the data repeater.
As the repeaters Items are databound I catch the controls as described in the template using FindControl method:
VB Code:
Dim lblName As Label = CType(e.Item.FindControl("lblName1"), Label)
As this is done the first time, the code above returns Nothing into the local variable lblName, as if the control couldn't be found at all. And this ends up in an exception. I checked and double checked and found no faults in the code and decided to debug a little further. I tested the first control at the start of the FindControls and skipped if control is nothing the rest of the block. This allowed the debug to continue running and as the itemDataBound fired again (that is the second time) all of the controls were found and the whole thing worked as planned .
My question is: What happens when the event fires the first time? Why are no controls found in the template at all? Is the repeater firing blanks?
Re: [resolved]Repeater problem
Thanks Magiaus. Will look into it more deeply as time permits!
tsami