Search code examples
asp.neteventsuser-controlsdatabound

asp.net perform action after child controls databound complete


I have a usercontrol that acts as a container to hold more usercontrols within it.

I need to perform certain access checks once all of the child controls have databound.

I was hoping I could attach to a usercontrol.databound event but there does not seem to be one.

What other options do I have to do something on the parent usercontrol once the other usercontrols have databound. I assume I have to get the child controls to notify the parent they have databound and the parent will need to track which have databound and which have not and when they all have databound it can peform its action.


Solution

  • You don't need to get the child controls to notify the parent. Look at the ASP.Net Page :Life Cycle. You need to put the code in the container user control in the PreRender event. This executes after the postback events.