Calling a method in parent page from dynamically generated user control
<p>I have a problem similar to <a href="http://stackoverflow.com/questions/623136/calling-a-method-in-parent-page-from-user-control">Calling a method in parent page from user control</a>, except that my user control is dynamically generated at page creation.</p>

<p>I tried the preferred solution in the answer above, but since I don’t know in advance how many copies of the control will be required on the page, I can’t subscribe to the event on Page_Load.</p>

<p>This application needs a major overhaul in its logic, but it’s out of scope for my current project.
I’ve currently implemented the less preferred <code>((MyPageName)this.Page).CustomMethod();</code>, but would like to do it the “right” way if I can.</p>

<p>Do you have any suggestions?</p>

<p>EDIT: The code for the control is in a page separate from the page. (I intend to reuse it elsewhere in the project.) This means the control doesn't know what handlers are available on the page.</p>
