Connects the WebChartViewer system to the Web Form to support dynamically created WebChartViewer controls.
This method is for supporting programs that may create WebChartViewer controls dynamically at runtime. It is not needed if the controls are created during design time (eg. created by using ASP.NET tags, or by dragging and dropping the control onto the Web Form in Visual Studio.NET.)
For WebChartViewer to work, it needs to initialize properly. In particular, it needs to see the Init event of the Web Form. However, for dynamically created controls, if the controls are created late in the Web Form life cycle (eg. in Page_Load, which occurs after Init), the controls will not see the Web Form Init event.
The OnPageInit method is specially designed to solve this problem. This method is a Shared (in VB) or static (in C#) method, and so can be called without creating any instance of WebChartViewer. If your code may dynamically create a WebChartViewer control after the Web Form Init event, you need to put the following line of code in the Init event handler (usually called Page_Init or OnInit) of your Web Form.
[VB] | WebChartViewer.OnPageInit(Me) |
[C#] | WebChartViewer.OnPageInit(this); |
Note that the above code needs to run irrespective of whether the WebChartViewer control will actually be created.
© 2012 Advanced Software Engineering Limited. All rights reserved.