views:

19

answers:

1

I have a custom control which contains a Repeater control. The Repeater has an ItemTemplate. Inside that item template I have a panel which is going to hide something based on "IsEditable" a boolean property of the custom control. What I would like to do is set the panel's visibility once before the Repeater is databound.

I know I could do an onItemDataBound event and use FindControl to get the panel but that seems a little excessive since it will always be either visible or not for all rows and I have no other actions that need to occur on databind.

Is there a way to find the control in the ItemTemplate before the Repeater is databound?

+1  A: 

try this:

<ItemTemplate>
    <asp:Panel Visible='<%# this.IsEditable %>' runat="server">
        editableStuff
    </asp:Panel>
</ItemTemplate>
dave thieben
This worked. Thanks.
William