Public Interface IPreRenderOverride
Dim instance As IPreRenderOverride
public interface IPreRenderOverride
The Microsoft.SharePoint.WebControls.IPreRenderOverride interface is meant to enforce interface implementation of the PreRender event. This is most important when working with controls that use AJAX, since the event has implications that affect the functionality of extender controls.
The IPreRenderOverrride interface structure is trivial. When being used as a base interface for inheritance, it demands that the OnPreRenderOverride member be implemented. The OnPreRenderOverride has one System.EventArgs parameter which contains the event data.
It should be noted that when using this interface, the base OnPreRender(EventArgs) method should be invoked in order to ensure that script blocks and services are correctly handled for partial-page rendering.
The heaviest representation of the IPreRenderOverride interface within the shipped software is in script dependent controls such as Microsoft.SharePoint.WebControls.Menu. However, as a trivially simple interface it is completely possible to use within your custom code by inheritance. The primary usage of the class is when a custom class requires that script blocks are handled correctly during the PreRender stage in order to support partial-page updates.
In the below example, MyClass is inheriting from the System.Web.UI.WebControls.WebParts.WebPart class as well as the the IPreRenderOverrride interface. From this interface, the contracted OnPreRenderOverride is being implemented. Within the implemented OnPreRenderOverride, we are calling the base class OnPreRender from the derived class. Calling the base class OnPreRender method is important regardless of future modifications, otherwise the WebPart will be prone to losing handlers.
public class MyClass : WebPart, IPreRenderOverride { public void OnPreRenderOverride(EventArgs arguments) { base.OnPreRender(arguments); }}
Public Class [MyClass] Inherits WebPart Implements IPreRenderOverride Public Sub OnPreRenderOverride(ByVal arguments As EventArgs) MyBase.OnPreRender(arguments) End SubEnd Class