System.Web.UI.Page.VerifyRenderingInServerForm Method

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

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
public virtual void VerifyRenderingInServerForm (Control control)

Parameters

control
The ASP.NET server control that is required in the System.Web.UI.HtmlControls.HtmlForm control.

Remarks

Controls that are required to be inside <form runat=server> tags can call this method before they render so that an error message is shown if they are placed outside the tags. Controls that post back or depend on registered script blocks should call this method in an override of the Control.Render(HtmlTextWriter) method. Pages that have a different way of rendering the server form element can override this method 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 System.Web.UI.HtmlControls.HtmlForm server control (<form runat="server">) tags. These controls can call this method when they render to provide a clear error message when they are not enclosed in the System.Web.UI.HtmlControls.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 Page.GetPostBackEventReference(Control), or if it emits client script. A composite server control does not need to make this call.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0