asp.netdatabound-controlsnested-controls

How can I access the parent datasource in data expression syntax in Asp.net?


I have a Repeater inside the TemplateField for a GridView. GridView is bound to datasource1 and the repeater to datasource2. How can i access datasource1 from the ItemTemplate of repeater in data binding syntax (<%# %>) of repeater itemtemplate?


Solution

  • See this question. That question was relevant to Repeaters but you get the idea. The GridView exposes the RowDataBound event which you can handle in the same way.

    Of course, I don't believe there is a way to access it via the declarative Databinding syntax.