System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.HtmlControls.HtmlContainerControl

The control is a container for server controls on a Web Forms page. All server controls that post back to the server must be placed between the opening and closing tags of an control.

ASP.NET allows only a single control to be active on a Web Forms page. If there is more than one active control on a Web Forms page, the common language runtime will throw an exception when you request the page. You can, however, use a control where each object contains one control, because only one is active at any given time.

You can control the behavior of the control by setting its properties. To specify the encoding type for the form's data, set the property. The method (GET or POST) that a browser uses to post form data to the server for processing is specified by setting the property.

By default, the property is set to POST. You can modify the value of this property to GET, but this might break the built-in state and postback services provided by the ASP.NET page framework.

You can configure controls that implement the interface to post to a different target page. This is referred to as cross-page posting. For more information, see Cross-Page Posting in an ASP.NET Web Page.

For a list of initial property values for an instance of , see the constructor.

Provides programmatic access to the HTML <form> element on the server.

- Constructor

  Use this constructor to create and initialize a new instance of the class.

  The following table shows the initial property value for an instance of .

  Property

  Initial Value

  The "form" literal string.

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.Web.UI.ControlCollection To be added.

  Creates a new collection for the control.

  A that contains the control's child server controls.

- Property
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  The property lets you specify that users can cause a postback by pressing ENTER in an input control in the form (such as a text box). You can specify as a default button any control that derives from the interface except the control. If the control that is referenced by the property does not derive from , an exception is thrown.

  If you are using master pages and you set the property from a content page, use the property of the button. For more information about master pages, see ASP.NET Master Pages Overview.

  The property might not cause a postback in the following scenarios:

  Pressing ENTER when focus is outside the input controls in the form. The default postback action is not guaranteed to be triggered.

  Pressing ENTER when focus is inside a multi-line text box. In a multi-line text box, the expected behavior is that pressing ENTER creates a new line in the text box. In some browsers, pressing ENTER inside a multi-line text box triggers a postback. In that case, if you want ENTER to create a new line instead, you can attach a JavaScript function to the input control. The script should capture the ENTER key and stop the postback. For example, you can use the property collection to add client script for the onKeyPress event.

  Specifying a control as a default button. Only and controls are supported.

  Changing the property programmatically during an asynchronous postback. Asynchronous postbacks can be enabled on a page by adding one or more controls to the page. For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview.

  Gets or sets the child control of the control that causes postback when the ENTER key is pressed.

- Property
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  Use the property to access the control on the form to display as the control with input focus when the control is loaded. Controls that can be selected are displayed with a visual cue indicating that they have the focus. For example, a control with focus is displayed with the insertion point positioned inside of it.

  The control with focus can also be set using the or methods. These methods have precedence over the property. If either of these methods are called to set the control with focus, the value of the property is ignored.

  Gets or sets the control on the form to display as the control with input focus when the control is loaded.

- Property
  System.String To be added: an object of type 'string'

  Use the property to specify the encoding type a browser uses to post data back to the server.

  The following table shows the common encoding types.

  Encoding type

  Description

  application/x-www-form-urlencoded

  Form data is encoded as name/value pairs. This is the standard encoding format.

  multipart/form-data

  Form data is encoded as a message with a separate part for each control on the page.

  text/plain

  Form data is encoded in plain text, without any control or formatting characters.

  For more information on encoding types, see the World Wide Web Consortium (W3C Web site.

  Gets or sets the encoding type a browser uses when posting the form's data to the server.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue("")
- Property
  System.String To be added: an object of type 'string'

  Use this property to specify how the browser sends form data to the server for processing. The two common methods supported by all browsers are GET and POST.

  You can override the default value of this property and use the GET method instead of POST. However, because GET requests are limited in how much data they can include, using the GET method can, in some cases, cause the postback and state management capabilities provided by the ASP.NET page framework to fail.

  Gets or sets a value that indicates how a browser posts form data to the server for processing.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue("")
- Property
  System.String To be added: an object of type 'string'

  Use the property to determine the unique identifier name for an control. In this implementation, getting this property returns the value of the property. However, setting the property does not assign a value to the property. Setting the property does not assign a value to this property because the property must have the same value as the property.

  The name attribute is not an XHTML-compliant attribute and is not rendered by ASP.NET regardless of the xhtmlConformance setting.

  Gets the identifier name for the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue("")
- Method
  System.Void ``

  When notified by the method, Web server controls must perform any initialization steps that are required to create and set up an instance. In this stage of the server control's life cycle, the control's view state has yet to be populated. Additionally, you cannot access other server controls when this method is called, regardless of whether it is a child or parent to this control. Other server controls are not guaranteed to be created and ready for access.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  The method is used primarily by control developers extending the functionality of the control.

  Raises the event for the control.

  A that contains event data. 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method is called just prior to rendering the control. If the property is set to true, the method registers the smart navigation script file reference so that it gets rendered.

  The property has been deprecated in ASP.NET version 2.0.

  Raises the event for the control.

  An that contains the event data.
- Method
  System.Void `` a

  The method renders an HTML <iframe> element if the property is set to true. The method calls the base method.

  The method is used primarily by control developers extending the functionality of the control.

  Renders the control to the specified object.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` a

  The method uses the method to check the control's attributes to ensure that they can be rendered in the opening tag of a <form> HTML element.

  Additionally, the method renders the method, action, and onsubmit attributes of the control. If the control ID set in the property does not implement the interface, an exception is thrown.

  The method is used primarily by control developers extending the functionality of the control.

  Renders the control's attributes to the specified object.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` a

  The method renders client script to ensure that the browser focus is set to the control specified in the property.

  A control specified by the property takes precedence over a control specified by the property.

  Renders the child controls of the control.

  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.Void `` To be added. To be added.

  Renders the control to the specified object.

- Property
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  Use the property to specify whether to force controls disabled on the client to submit their values when the page posts back. This allows the disabled controls to preserve their values after the page posts back to the server. When the property is set to false, controls on the form that have been disabled using client script will not be submitted to the server the next time the page posts back. As a result, any values stored by the disabled controls are lost. To allow the disabled controls to preserve their values after the page posts back to the server, set the property to true.

  Gets or sets a Boolean value indicating whether to force controls disabled on the client to submit their values, allowing them to preserve their values after the page posts back to the server.

- Property
  System.String To be added: an object of type 'string'

  Use the property to specify the target window or frame that displays the results of the information that is posted to the server. Redirecting the results of the information posted to the server is an advanced task. Using this property simply to post back is not recommended.

  The property renders as a target attribute. The target attribute on form elements is not allowed in XHTML 1.1. Therefore, if the rendered markup must conform to XHTML standards or must conform to accessibility standards, do not set the property. For more information, see ASP.NET and XHTML Compliance and Accessibility in Visual Studio 2010 and ASP.NET 4.

  The value must begin with a letter in the range of A to Z (case-insensitive), except for the following special values, which begin with an underscore.

  Target value

  Description

  _blank

  Renders the content in a new window without frames.

  _parent

  Renders the content in the immediate frameset parent.

  _search

  Renders the content in the search pane.

  _self

  Renders the content in the frame with focus.

  _top

  Renders the content in the full window without frames.

  Check your browser documentation to determine if the _search value is supported. For example, Microsoft Internet Explorer 5.0 and later support the _search target value.

  Gets or sets the frame or window in which to render the results of information that is posted to the server.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue("")
- Property
  1.0.5000.0
  2.0.0.0
  System.String To be added.

  Use the property to get the unique programmatic identifier assigned to the control. This property overrides the base implementation to return a constant value when the control is contained in an -implemented object other than a page, such as a custom server control. If the naming container is a page, the value of the control's property is returned.

  The property and the property always return the same value. This is useful when the control is rendered on a browser that requires the control's and properties to be the same. To keep these properties synchronized, the property always returns the value of the property.

  The name attribute is not an XHTML-compliant attribute and by default is not rendered by ASP.NET.

  Gets the unique programmatic identifier assigned to the control.