AI OnAI Off
///
/// If there is a control implementing the IPageSource
/// interface higher up in the control hiearchy
/// the actualPage will be set to the current page of that control.
/// If no such control is found the actualPage will be set to
/// the CurrentPage of this control.
///
/// If a control is found this would imply that a templated control
/// is using this user control (for example a page list). Then we
/// are interested of the page currently being iterated in the
/// templated control, not the page containing
/// the templated control.
///
///
private void SetActualPage(Control control)
{
if ((control.GetType().GetInterface("IPageSource") != null))
_actualPage = ((IPageSource) control).CurrentPage;
else if (control.Parent == null)
_actualPage = CurrentPage;
else
SetActualPage(control.Parent);
}
private void Page_Init(object sender, System.EventArgs e)
{
SetActualPage(this.Parent);
}