VerifyRenderingInServerForm Method

Page.VerifyRenderingInServerForm Method

Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.

[Visual Basic]
Public Overridable Sub VerifyRenderingInServerForm( _
   ByVal control As Control _
public virtual void VerifyRenderingInServerForm(
 Control control
public: virtual void VerifyRenderingInServerForm(
 Control* control
public function VerifyRenderingInServerForm(
   control : Control


The ASP.NET server control that is required to be in the HtmlForm control.


Exception Type Condition
HttpException The specified server control is not contained between the opening and closing tags of the HtmlForm server control at run time.


This method will throw an exception if the page is not currently in the render phase of page processing, and inside the <form runat=server> tags. Controls that are required to be inside the server form can call this during render so that a clear error message is shown when they are placed outside. Controls that post back or depend on registered script blocks should call this in an override of the Control.Render method. Pages that have a different way of rendering the server form element can override this to throw an exception under different conditions.

Server controls that post back or use client-side script will not work if they are not enclosed in the HtmlForm server control (<form runat="server">). These controls can call this method when they render to provide a clear error message when they are not enclosed in the HtmlForm control.

When you develop a custom server control, it is common to call this method when you override the Render method for any kind of input tag. This is particularly important if the input control calls GetPostBackEventReference, or if it emits client script. A composite server control does not need to make this call.

You should not override this method unless you are creating an alternative page framework.


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace

© 2016 Microsoft