views:

57

answers:

0

Hi, I have built lots of custom asp.net controls which work really well separately but I want to somehow allow global access to all their variables from anywhere on the page. I have a central control called the ContentManager which I can use to store these variables. The problem I have is that all the controls are bound at different times so I only want the variables available after they're bound.

For example I have many custom repeaters on the page which when bound I want to add a reference in the content manager so all their variables are then available to use.

<Custom:ContentManager ID="cm" runat="server"/>

<Custom:Repeater ID="r1" runat="server"/>
<Custom:Repeater ID="r2" runat="server"/>
<Custom:Repeater ID="r3" runat="server"/>

Then I want a tag which can access all variables from any of these controls.

<%= cm.controls["r1"].Items[0]["name"] %>

The problem with this is that the variable isn't available until the repeater is bound so I might need to use events to push out the value to tags on the page like so:

<Custom:Var ID="v1" control="r1" value="Items[0]["name"]" runat="server"/>

Is this possible or can you recommend a better approach?