System.Web 2.0.0.0 System.Web.UI.WebControls.DataControlField

The class is used by data-bound controls (such as and ) to display custom content for each record displayed. When you need to display content in a data-bound control that is not provided by one of the predefined data control fields (such as ), use the class to create your custom user interface (UI). The object is displayed differently depending on the data-bound control in which it is used. For example, the control displays a object as a column, and the control displays it as a row.

You can define a custom template for the different parts of the object using the templates listed in the following table.

Template

Description

Specifies the content to display for the alternating items in a object.

Specifies the content to display for an item in edit mode in a object.

Specifies the content to display for the footer section of a object.

Specifies the content to display for the header section of a object.

Specifies the content to display for an item in insert mode in a object. This template is supported only by the control.

Specifies the content to display for the items in a object.

You can hide a object in a data-bound control by setting the property to false.

As an alternative to defining a custom or template, you can customize the header and footer sections of a object by setting other properties of the object. To display a caption in the header or footer sections, set the or the property, respectively. Instead of displaying text in the header section, you can display an image by setting the property. The header section can be hidden in the object by setting the property to false.

Some data-bound controls (such as the control) can show or hide only the entire header section of the control. These data-bound controls do not support the property for an individual bound field. To show or hide the entire header section of a data-bound control, use the control's ShowHeader property (if available).

You also can customize the appearance of the object (font color, background color, and so on) by setting the style properties for the different parts of the field. The following table lists the different style properties.

Style property

Description

The style settings for the child Web server controls of the object.

The style settings for the footer section of the object.

The style settings for the header section of the object.

The style settings for the data items in the object.

Represents a field that displays custom content in a data-bound control.

- Constructor

  Use this constructor to initialize a new instance of the class. This constructor is commonly used when adding fields to a dynamically created data-bound control.

  To dynamically add a object to a data-bound control, create a new object, define the appropriate templates, and then add it to the data-bound control's field collection. For example, if you are using the control, add the object to the collection.

  Although you can dynamically add fields to a data-bound control, it is strongly recommended that fields be statically declared and then shown or hidden, as appropriate. Statically declaring all your fields reduces the size of the view state for the parent data-bound control.

  Initializes a new instance of the class.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.IDataItemContainer), System.ComponentModel.BindingDirection.TwoWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  Use the property to specify the custom content displayed for the alternating items in a object. Define the content by creating a template that specifies how the alternating items are rendered.

  The property is commonly used in combination with the property to create a different appearance for every other item in the data-bound control.

  To specify a template, first place opening and closing <AlternatingItemTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <AlternatingItemTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

  To programmatically access a control defined in a template, first determine which object in the data-bound control contains the control. Next, use the collection of the object to access the control. You can also use the method of the object to find the control, if the control has an property specified.

  Gets or sets the template for displaying the alternating items in a object.

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

  This property applies to two-way data-binding statements made in the template. The conversion is done after extracting the values from the two-way bound template, and before passing the values to the data source for an update or insertion operation.

  For example, a user might enter an empty string ("") for a field value when updating or inserting records. Use the property to specify whether an empty string value is automatically converted to null when the data field is updated in the data source.

  Gets or sets a value indicating whether the value that the object is bound to should be converted to null if it is .

  2.0.0.0
- Method
  System.Void ``

  The method is a helper method used to copy the properties of the current -derived object to the object created by the method.

  Copies the properties of the current -derived object to the specified object.

  The to copy the properties of the current to. 2.0.0.0
- Method
  System.Web.UI.WebControls.DataControlField

  The method overrides the base method to return a object.

  Creates a new object.

  Always returns a new .

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.IDataItemContainer), System.ComponentModel.BindingDirection.TwoWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  Use the property to specify the custom content displayed for an item that is in edit mode in a object. Define the content by creating a template that specifies how an item in edit mode is rendered. The property usually contains input controls for the user to modify a value in a data source.

  To specify a template, first place opening and closing <EditItemTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <EditItemTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

  To programmatically access a control defined in a template, first determine which object in the data-bound control contains the control. Next, use the collection of the object to access the control. You can also use the method of the object to find the control, if the control has an property specified.

  Gets or sets the template for displaying an item in edit mode in a object.

  2.0.0.0
- Method
  System.Void `` `` `` ``

  The method is implemented by types derived from , such as . This method is called to extract the values of two-way data-bound fields in the template to populate dictionaries to be passed to the data source for an update, insert, or delete operation. The field/value pair is stored in the dictionary collection that is passed to the method. The method is called by the ExtractRowValues method of data controls such as and .

  Extracts the value of the data control fields as specified by one or more two-way binding statements (DataBind) from the current table cell and adds the values to the specified collection.

  An . A that contains the text or controls of the . One of the values. true to indicate that the values of read-only fields are included in the collection; otherwise, false. 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.IDataItemContainer), System.ComponentModel.BindingDirection.OneWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  Use the property to specify the custom content displayed in the footer section of a object. Define the content by creating a template that specifies how the footer section is rendered.

  To specify a template, first place opening and closing <FooterTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <FooterTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

  To programmatically access a control defined in a template, first determine which object in the data-bound control contains the control. Next, use the collection of the object to access the control. You can also use the method of the object to find the control, if the control has an property specified.

  Gets or sets the template for displaying the footer section of a object.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.IDataItemContainer), System.ComponentModel.BindingDirection.OneWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  Use the property to specify the custom content displayed for the header section of a object. Define the content by creating a template that specifies how the header section is rendered.

  To specify a template, first place opening and closing <HeaderTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <HeaderTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

  To programmatically access a control defined in a template, first determine which object in the data-bound control contains the control. Next, use the collection of the object to access the control. You can also use the method of the object to find the control, if the control has an property specified.

  Gets or sets the template for displaying the header section of a object.

  2.0.0.0
- Method
  System.Void `` `` `` ``

  Call this method when you are creating a custom data-bound control that uses objects to initialize the cells of the table structure with data or controls.

  Adds text or controls to a cell's controls collection.

  A that contains the text or controls of the . One of the values. One of the values, specifying the state of the row that contains the . The index of the row that the is contained in. 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.IDataItemContainer), System.ComponentModel.BindingDirection.TwoWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  Use the property to specify the custom content displayed for an item in insert mode in a object. Define the content by creating a template that specifies how the item in insert mode is rendered.

  To specify a template, first place opening and closing <InsertItemTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <InsertItemTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

  To programmatically access a control defined in a template, first determine which object in the data-bound control contains the control. Next, use the collection of the object to access the control. You can also use the method of the object to find the control, if the control has an property specified.

  Not all data-bound controls support this template This template is supported only by data-bound controls that allow you to insert a record, such as the control.

  Gets or sets the template for displaying an item in insert mode in a object.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.IDataItemContainer), System.ComponentModel.BindingDirection.TwoWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  Use the property to specify the custom content displayed for the items in a object. Define the content by creating a template that specifies how the items are rendered.

  You can optionally define the property in combination with the property to create a different appearance for every other item in the data-bound control.

  To specify a template, first place opening and closing <ItemTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <ItemTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

  To programmatically access a control defined in a template, first determine which object in the data-bound control contains the control. Next, use the collection of the object to access the control. You can also use the method of the object to find the control, if the control has an property specified.

  Gets or sets the template for displaying an item in a data-bound control.

  2.0.0.0
- Method
  System.Void

  The method is not supported for this class and always throws a exception.

  Determines whether the controls contained in a object support page callbacks.

  2.0.0.0