I am writing a class (outside of the deafult page webform) and it needs access to a mschart. The chart is called "Chart1".
I discovered on other forums that in order for a class to access the webform control, you do the following:
System.Web.UI.Page page = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
Chart Chart1 = (Chart)page.FindControl("Chart1");
But can someone tell me what does the first line do and why does it work? What is it trying to do? Why is it setting the context.current.handler to page? and why does it need to be cast to a page?
Secondly, why can't I create the page object by referencing the page class name, which is _Default in this case? (public partial class _Default : System.Web.UI.Page)
View Complete Post