Max said:
I want to do something like this in the user control:
Call myParentPage.BindSQL()
BindSQL is a sub on the parent page. This user control will be used on
multiple pages. Perhaps this is not a good idea? This is why it is so
difficult?
-Max
You have a .Page property in the user control, the only problem is you
need to cast it before calling that function....
((MyPageClass)this.Page).BindSQL
But if you do this, you're tying your user control to one type of
containing page (which is usually one page). If you do it this way, I'd
pry create a superclass for all pages that share this function and then
cast to that type.....
The other way to do it (and is pry better from an OO encapsulation
standpoint) is to expose an event in the user control that it raises
when it wants to call the .Page's function. But instead of having to
know the page type, or function name, the user control lets the page be
responsible for registering an event handler/listener to that event when
it creates one of your user controls.