Last post Mar 27, 2015 08:40 AM by ata6502
Mar 26, 2015 09:26 AM|ata6502|LINK
Is there a way of accessing an underlying instance of a class specified in the Type attribute of an ObjectDataSource?
Mar 26, 2015 11:34 PM|Kevin Shen - MSFT|LINK
Thanks for your post here.
I am not quite sure why need to access the a class specified in the Type attribute of an ObjectDataSource?
I suggest that you could refer to the tutorial in the link below:
Mar 27, 2015 08:40 AM|ata6502|LINK
Thanks Kevin for your response and the link. Unfortunately, I can't use the suggested solution as I have little control over the middle-tier object. In fact, that's why I need to access it. It requires some kind of initialization i.e., after creating it
I need to call an Initialize method with certain parameters. Then, through the page lifetime, I need to access some properties of this instance.
It seems I have found a suitable candidate for a solution: the ObjectDataSource.OnObjectCreating event handler. An idea is to manually create an instance of my middle-tier component, call the Initialize method, and then assign it to a page scope field for
other methods to access. Do you think this is a good idea?