title: Firing an event to the parent page when a user control finishes loading in ASP.NET
body: <p>I am working with an ASP.NET project that was created by a team elsewhere in the company. One of the pages that I am working with features a userControl that queries the database to populate a generic field. The information from this query is then used by the parent page (that is, the page that contains the userControl) to set the selectedIndex of a dropdown. </p>
  
  <p>The issue that I am having is that the parent page loads before the userControl, which means that the parent page loads before the results of the query are available. As a result, the selectedIndex of the dropdown is only ever set to a default index.</p>
  
  <p>Based on jrista's answer to <a href="https://stackoverflow.com/questions/949517/asp-net-when-usercontrols-loads">ASP .NET: when UserControls loads?</a> , I understand that the page.OnLoad event fires before the userControl.OnLoad event. I also understand that there is no OnLoadComplete event for user controls, which I was hoping I could use to make an event that fires on the parent page when the user control finishes loading.</p>
  
  <p>I've heard that the Pre-Render event can be used to the same effect (<a href="http://forums.asp.net/t/1658733.aspx?OnLoadComplete+and+UserControls" rel="nofollow noreferrer" title=" OnLoadComplete and UserControls">based on this question over on the asp forums</a>), but is this the only approach? Is there a better way to fire an event from a userControl to the parent page when the user control finishes loading? Or is this simply not a good practice and would I be better to somehow change the code to avoid this situation?</p>