Hi
I have a web usercontrol which is placed inside the itemtemplate of a repeater. When the on load event fires for the control the control attempts to access a property which should have been initialised by the application context, but hasn't. The property is initialised correctly when the control is placed on a page outside of a repeater.
As a work around I've put a check to see if the property is null, if so I access the ApplicationContext directly from the control to retrieve a reference to the object and initiliase the property manually. Obviously this is not the way forward, what am I doing wrong?
Control config entry:
Referenced object config entry:Code:<object name="HardBopRecords.WebApp.Controls.ImageViewer" type="HardBopRecords.WebApp.Controls.ImageViewer, HardBopRecords.WebApp" singleton="false" lazy-init="false"> <property name="ImageProcessingService"> <ref object="ImageProcessingService" /> </property> </object>
Reference to control in repeater:Code:<services xmlns="http://www.springframework.net" default-lazy-init="true"> <object name="ImageProcessingService" type="HardBopRecords.Services.Image.ImageProcessingService, HardBopRecords.Services"> </object>
Code:<ItemTemplate> <TR> <TD class="ListTableItem"><HARDBOPRECORDS:IMAGEVIEWER Src='<%#DataBinder.Eval(Container, "DataItem.Image.FileName")%>' ProcessedSrc="<fileName>_table.jpg" Alt='<%#DataBinder.Eval(Container, "DataItem.Image.Name")%>' id="Imageviewer1" ActionName="table" ImageFormat="jpg" runat="server"></HARDBOPRECORDS:IMAGEVIEWER></TD>
Thanks


Reply With Quote

